[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251114170623.GK196370@frogsfrogsfrogs>
Date: Fri, 14 Nov 2025 09:06:23 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: Christoph Hellwig <hch@....de>
Cc: Carlos Maiolino <cem@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Chris Li <sparse@...isli.org>, linux-sparse@...r.kernel.org,
linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] xfs: work around sparse context tracking in
xfs_qm_dquot_isolate
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@....de>
Reviewed-by: "Darrick J. Wong" <djwong@...nel.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
>
>
Powered by blists - more mailing lists