From fde66523a0c15e680a4ce67af1da998a0f055c20 Mon Sep 17 00:00:00 2001 From: xuchenchen Date: Mon, 3 Nov 2025 15:41:20 +0800 Subject: [PATCH] xfs_scrub: handle spurious wakeups in scan_fs_tree --- ...dle-spurious-wakeups-in-scan_fs_tree.patch | 31 +++++++++++++++++++ xfsprogs.spec | 6 +++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 0061-xfs_scrub-handle-spurious-wakeups-in-scan_fs_tree.patch diff --git a/0061-xfs_scrub-handle-spurious-wakeups-in-scan_fs_tree.patch b/0061-xfs_scrub-handle-spurious-wakeups-in-scan_fs_tree.patch new file mode 100644 index 0000000..a93b804 --- /dev/null +++ b/0061-xfs_scrub-handle-spurious-wakeups-in-scan_fs_tree.patch @@ -0,0 +1,31 @@ +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 e03396a..f41f771 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 5.14.1 -Release: 19 +Release: 20 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -79,6 +79,7 @@ Patch57: 0057-xfs_io-Implement-lsattr-and-chattr-support-for-atomi.patch Patch58: 0058-xfs_scrub-fix-reporting-if-we-can-t-open-raw-block-d.patch Patch59: 0059-mkfs-fix-the-issue-of-maxpct-set-to-0-not-taking-eff.patch Patch60: 0060-xfs_repair-don-t-leak-the-rootdir-inode-when-orphana.patch +Patch61: 0061-xfs_scrub-handle-spurious-wakeups-in-scan_fs_tree.patch %description xfsprogs are the userspace utilities that manage XFS filesystems. @@ -162,6 +163,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Mon Nov 3 2025 xuchenchen - 5.14.1-20 +- xfs_scrub: handle spurious wakeups in scan_fs_tree + * Fri Oct 17 2025 liuh - 5.14.1-19 - sync patch from community xfs_repair: don't leak the rootdir inode when orphanage already exists -- Gitee