From a536bf9bec6ac461ec48bc8627545d56e4e71e9c Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 10 Nov 2025 14:23:04 +0100 Subject: [PATCH] xfs: push q_qlock acquisition from xchk_dquot_iter to the callers. There is no good reason to take q_qlock in xchk_dquot_iter, which just provides a reference to the dquot. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Carlos Maiolino --- fs/xfs/scrub/dqiterate.c | 1 - fs/xfs/scrub/quota.c | 1 + fs/xfs/scrub/quota_repair.c | 1 + fs/xfs/scrub/quotacheck.c | 1 + fs/xfs/scrub/quotacheck_repair.c | 1 + 5 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/xfs/scrub/dqiterate.c b/fs/xfs/scrub/dqiterate.c index 6f1185afbf39..20c4daedd48d 100644 --- a/fs/xfs/scrub/dqiterate.c +++ b/fs/xfs/scrub/dqiterate.c @@ -205,7 +205,6 @@ xchk_dquot_iter( if (error) return error; - mutex_lock(&dq->q_qlock); cursor->id = dq->q_id + 1; *dqpp = dq; return 1; diff --git a/fs/xfs/scrub/quota.c b/fs/xfs/scrub/quota.c index cfcd0fb66845..b711d36c5ec9 100644 --- a/fs/xfs/scrub/quota.c +++ b/fs/xfs/scrub/quota.c @@ -329,6 +329,7 @@ xchk_quota( /* Now look for things that the quota verifiers won't complain about. */ xchk_dqiter_init(&cursor, sc, dqtype); while ((error = xchk_dquot_iter(&cursor, &dq)) == 1) { + mutex_lock(&dq->q_qlock); error = xchk_quota_item(&sqi, dq); mutex_unlock(&dq->q_qlock); xfs_qm_dqrele(dq); diff --git a/fs/xfs/scrub/quota_repair.c b/fs/xfs/scrub/quota_repair.c index d4ce9e56d3ef..dae4889bdc84 100644 --- a/fs/xfs/scrub/quota_repair.c +++ b/fs/xfs/scrub/quota_repair.c @@ -512,6 +512,7 @@ xrep_quota_problems( xchk_dqiter_init(&cursor, sc, dqtype); while ((error = xchk_dquot_iter(&cursor, &dq)) == 1) { + mutex_lock(&dq->q_qlock); error = xrep_quota_item(&rqi, dq); mutex_unlock(&dq->q_qlock); xfs_qm_dqrele(dq); diff --git a/fs/xfs/scrub/quotacheck.c b/fs/xfs/scrub/quotacheck.c index bef63f19cd87..20220afd90f1 100644 --- a/fs/xfs/scrub/quotacheck.c +++ b/fs/xfs/scrub/quotacheck.c @@ -675,6 +675,7 @@ xqcheck_compare_dqtype( /* Compare what we observed against the actual dquots. */ xchk_dqiter_init(&cursor, sc, dqtype); while ((error = xchk_dquot_iter(&cursor, &dq)) == 1) { + mutex_lock(&dq->q_qlock); error = xqcheck_compare_dquot(xqc, dqtype, dq); mutex_unlock(&dq->q_qlock); xfs_qm_dqrele(dq); diff --git a/fs/xfs/scrub/quotacheck_repair.c b/fs/xfs/scrub/quotacheck_repair.c index 3b23219d43ed..3013211fa6c1 100644 --- a/fs/xfs/scrub/quotacheck_repair.c +++ b/fs/xfs/scrub/quotacheck_repair.c @@ -155,6 +155,7 @@ xqcheck_commit_dqtype( */ xchk_dqiter_init(&cursor, sc, dqtype); while ((error = xchk_dquot_iter(&cursor, &dq)) == 1) { + mutex_lock(&dq->q_qlock); error = xqcheck_commit_dquot(xqc, dqtype, dq); mutex_unlock(&dq->q_qlock); xfs_qm_dqrele(dq);