linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: sandeen@sandeen.net, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs_scrub: remove unnecessary wakeup wait in scan_fs_tree
Date: Wed, 4 Sep 2019 18:20:10 +1000	[thread overview]
Message-ID: <20190904082010.GE1119@dread.disaster.area> (raw)
In-Reply-To: <156685449148.2840069.4205272438739819463.stgit@magnolia>

On Mon, Aug 26, 2019 at 02:21:31PM -0700, Darrick J. Wong wrote:
> 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>
> ---
>  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@redhat.com>


-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2019-09-04  8:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26 21:21 [PATCH 0/3] xfs_scrub: fix bugs in vfs tree walk code Darrick J. Wong
2019-08-26 21:21 ` [PATCH 1/3] xfs_scrub: refactor queueing of subdir scan work item Darrick J. Wong
2019-09-04  8:12   ` Dave Chinner
2019-09-04 16:37     ` Darrick J. Wong
2019-08-26 21:21 ` [PATCH 2/3] xfs_scrub: fix nr_dirs accounting problems Darrick J. Wong
2019-09-04  8:15   ` Dave Chinner
2019-08-26 21:21 ` [PATCH 3/3] xfs_scrub: remove unnecessary wakeup wait in scan_fs_tree Darrick J. Wong
2019-09-04  8:20   ` Dave Chinner [this message]
2019-09-06  3:33 [PATCH 0/3] xfs_scrub: fix bugs in vfs tree walk code Darrick J. Wong
2019-09-06  3:34 ` [PATCH 3/3] xfs_scrub: remove unnecessary wakeup wait in scan_fs_tree Darrick J. Wong
2019-09-25 21:31 [PATCH 0/3] xfs_scrub: fix bugs in vfs tree walk code Darrick J. Wong
2019-09-25 21:31 ` [PATCH 3/3] xfs_scrub: remove unnecessary wakeup wait in scan_fs_tree Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190904082010.GE1119@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).