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>
* 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);