Re: [PATCH 3/3] xfs_scrub: remove unnecessary wakeup wait in scan_fs_tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 26, 2019 at 02:21:31PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> ---
>  scrub/vfs.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/scrub/vfs.c b/scrub/vfs.c
> index b358ab4a..0e971d27 100644
> --- a/scrub/vfs.c
> +++ b/scrub/vfs.c
> @@ -235,7 +235,8 @@ scan_fs_tree(
>  		goto out_wq;
>  
>  	pthread_mutex_lock(&sft.lock);
> -	pthread_cond_wait(&sft.wakeup, &sft.lock);
> +	if (sft.nr_dirs)
> +		pthread_cond_wait(&sft.wakeup, &sft.lock);


Ok, fixes a typical pthread counting conditional bug. :/

Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>


-- 
Dave Chinner
david@xxxxxxxxxxxxx



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux