public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Carlos Maiolino <cem@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>,
	Chris Li <sparse@chrisli.org>,
	linux-sparse@vger.kernel.org, linux-xfs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs: work around sparse context tracking in xfs_qm_dquot_isolate
Date: Fri, 14 Nov 2025 09:06:23 -0800	[thread overview]
Message-ID: <20251114170623.GK196370@frogsfrogsfrogs> (raw)
In-Reply-To: <20251114055249.1517520-4-hch@lst.de>

On Fri, Nov 14, 2025 at 06:52:25AM +0100, Christoph Hellwig wrote:
> sparse gets confused by the goto after spin_trylock:
> 
> fs/xfs/xfs_qm.c:486:33: warning: context imbalance in 'xfs_qm_dquot_isolate' - different lock contexts for basic block
> 
> work around this by duplicating the trivial amount of code after the
> label.

Might want to leave a code comment about shutting up sparse so that
someone doesn't revert this change to optimize LOC.  That said ...
what is the differing lock context?  Does sparse not understand the
spin_trylock?

> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fs/xfs/xfs_qm.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index 95be67ac6eb4..66d25ac9600b 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -422,8 +422,11 @@ xfs_qm_dquot_isolate(
>  	struct xfs_qm_isolate	*isol = arg;
>  	enum lru_status		ret = LRU_SKIP;
>  
> -	if (!spin_trylock(&dqp->q_lockref.lock))
> -		goto out_miss_busy;
> +	if (!spin_trylock(&dqp->q_lockref.lock)) {
> +		trace_xfs_dqreclaim_busy(dqp);
> +		XFS_STATS_INC(dqp->q_mount, xs_qm_dqreclaim_misses);
> +		return LRU_SKIP;
> +	}
>  
>  	/*
>  	 * If something else is freeing this dquot and hasn't yet removed it
> @@ -482,7 +485,6 @@ xfs_qm_dquot_isolate(
>  
>  out_miss_unlock:
>  	spin_unlock(&dqp->q_lockref.lock);
> -out_miss_busy:
>  	trace_xfs_dqreclaim_busy(dqp);
>  	XFS_STATS_INC(dqp->q_mount, xs_qm_dqreclaim_misses);
>  	return ret;
> -- 
> 2.47.3
> 
> 

  reply	other threads:[~2025-11-14 17:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-14  5:52 make xfs sparse-warning free Christoph Hellwig
2025-11-14  5:52 ` [PATCH 1/3] lockref: add a __cond_lock annotation for lockref_put_or_lock Christoph Hellwig
2025-11-14 18:18   ` Linus Torvalds
2025-11-18  5:58     ` Christoph Hellwig
2025-11-14  5:52 ` [PATCH 2/3] xfs: move some code out of xfs_iget_recycle Christoph Hellwig
2025-11-14 17:04   ` Darrick J. Wong
2025-11-14 17:28     ` Linus Torvalds
2025-11-18  5:59     ` Christoph Hellwig
2025-11-14  5:52 ` [PATCH 3/3] xfs: work around sparse context tracking in xfs_qm_dquot_isolate Christoph Hellwig
2025-11-14 17:06   ` Darrick J. Wong [this message]
2025-11-18  6:00     ` Christoph Hellwig
2025-11-14 17:56 ` make xfs sparse-warning free Linus Torvalds
2025-11-18  5:57   ` Christoph Hellwig

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=20251114170623.GK196370@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cem@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.com \
    --cc=sparse@chrisli.org \
    /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