]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: remove unnecessary wakeup wait in scan_fs_tree
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 26 Sep 2019 17:46:06 +0000 (13:46 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Thu, 26 Sep 2019 17:46:06 +0000 (13:46 -0400)
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>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/vfs.c

index f8bc98c062da25f14851171a9579186fb4c41e0d..1a1482ddad50c78b6e77c1360f4649fd28f180f3 100644 (file)
@@ -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);