[3/3] xfs_scrub: remove unnecessary wakeup wait in scan_fs_tree
diff mbox series

Message ID 156944711783.296293.10730420610767677847.stgit@magnolia
State Accepted
Headers show
  • xfs_scrub: fix bugs in vfs tree walk code
Related show

Commit Message

Darrick J. Wong Sept. 25, 2019, 9:31 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

We don't need to wait on the condition variable if directory tree
scanning has already finished by the time we've finished queueing all
the directory work items.  This is easy to trigger when the workqueue is
single-threaded, but in theory it could happen any time.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
 scrub/vfs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/scrub/vfs.c b/scrub/vfs.c
index f8bc98c0..1a1482dd 100644
--- a/scrub/vfs.c
+++ b/scrub/vfs.c
@@ -246,7 +246,8 @@  scan_fs_tree(
 	 * about to tear everything down.
-	pthread_cond_wait(&sft.wakeup, &sft.lock);
+	if (sft.nr_dirs)
+		pthread_cond_wait(&sft.wakeup, &sft.lock);
 	assert(sft.nr_dirs == 0);