From: Darrick J. Wong Date: Thu, 26 Sep 2019 17:46:06 +0000 (-0400) Subject: xfs_scrub: remove unnecessary wakeup wait in scan_fs_tree X-Git-Tag: v5.3.0-rc2~109 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=44012ab058c10d88a3ecf2bfb3cdeb5281718d49;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: remove unnecessary wakeup wait in scan_fs_tree 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 Reviewed-by: Dave Chinner Signed-off-by: Eric Sandeen --- diff --git a/scrub/vfs.c b/scrub/vfs.c index f8bc98c06..1a1482dda 100644 --- a/scrub/vfs.c +++ b/scrub/vfs.c @@ -246,7 +246,8 @@ scan_fs_tree( * about to tear everything down. */ pthread_mutex_lock(&sft.lock); - pthread_cond_wait(&sft.wakeup, &sft.lock); + if (sft.nr_dirs) + pthread_cond_wait(&sft.wakeup, &sft.lock); assert(sft.nr_dirs == 0); pthread_mutex_unlock(&sft.lock);