diff --git a/0047-xfs_scrub-handle-spurious-wakeups-in-scan_fs_tree.patch b/0047-xfs_scrub-handle-spurious-wakeups-in-scan_fs_tree.patch new file mode 100644 index 0000000000000000000000000000000000000000..9dcde0a5b04335767748fa4c70d0ab513de45ae9 --- /dev/null +++ b/0047-xfs_scrub-handle-spurious-wakeups-in-scan_fs_tree.patch @@ -0,0 +1,32 @@ +From 817d1b67b6da0a1e2ac94c73ac12fcdb10be1d1e Mon Sep 17 00:00:00 2001 +From: "Darrick J. Wong" +Date: Wed, 20 Dec 2023 08:53:46 -0800 +Subject: xfs_scrub: handle spurious wakeups in scan_fs_tree + +Coverity reminded me that the pthread_cond_wait can wake up and return +without the predicate variable (sft.nr_dirs > 0) actually changing. +Therefore, one has to retest the condition after each wakeup. + +Coverity-id: 1554280 +Signed-off-by: Darrick J. Wong +Reviewed-by: Christoph Hellwig +--- + scrub/vfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scrub/vfs.c b/scrub/vfs.c +index 577eb6dc3e..3c1825a75e 100644 +--- a/scrub/vfs.c ++++ b/scrub/vfs.c +@@ -263,7 +263,7 @@ scan_fs_tree( + * about to tear everything down. + */ + pthread_mutex_lock(&sft.lock); +- if (sft.nr_dirs) ++ while (sft.nr_dirs > 0) + pthread_cond_wait(&sft.wakeup, &sft.lock); + assert(sft.nr_dirs == 0); + pthread_mutex_unlock(&sft.lock); +-- +cgit 1.2.3-korg + diff --git a/xfsprogs.spec b/xfsprogs.spec index aeba965725587a608faab2af8da6e86a3e1ce130..c23eba0160d29461fef9ebe804ec448003c60929 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 5.14.1 -Release: 15 +Release: 16 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -65,6 +65,7 @@ Patch43: 0043-xfs_repair-retain-superblock-buffer-to-avoid-write-h.patch Patch44: 0044-fsck.xfs-mount-umount-xfs-fs-to-replay-log-before-ru.patch Patch45: 0045-xfs_db-fix-dir3-block-magic-check.patch Patch46: 0046-xfs_repair-fix-incorrect-dabtree-hashval-comparison.patch +Patch47: 0047-xfs_scrub-handle-spurious-wakeups-in-scan_fs_tree.patch %description @@ -149,6 +150,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Tue Mar 19 2024 liuh - 5.14.1-16 +- xfs_scrub: handle spurious wakeups in scan_fs_tree + * Wed Dec 27 2023 wuguanghao - 5.14.1-15 - backport patches from community