[PATCH 3/3] xfs: work around sparse context tracking in xfs_qm_dquot_isolate

Christoph Hellwig
2025-11-14T05:53:08Z

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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
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