linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Carlos Maiolino <cem@kernel.org>
Cc: linux-xfs@vger.kernel.org, "Darrick J. Wong" <djwong@kernel.org>
Subject: [PATCH 12/18] xfs: push q_qlock acquisition from xchk_dquot_iter to the callers.
Date: Mon, 10 Nov 2025 14:23:04 +0100	[thread overview]
Message-ID: <20251110132335.409466-13-hch@lst.de> (raw)
In-Reply-To: <20251110132335.409466-1-hch@lst.de>

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 <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
---
 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);
-- 
2.47.3


  parent reply	other threads:[~2025-11-10 13:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 13:22 cleanup quota locking v2 Christoph Hellwig
2025-11-10 13:22 ` [PATCH 01/18] xfs: don't leak a locked dquot when xfs_dquot_attach_buf fails Christoph Hellwig
2025-11-10 18:03   ` Darrick J. Wong
2025-11-10 13:22 ` [PATCH 02/18] xfs: make qi_dquots a 64-bit value Christoph Hellwig
2025-11-10 18:04   ` Darrick J. Wong
2025-11-10 13:22 ` [PATCH 03/18] xfs: don't treat all radix_tree_insert errors as -EEXIST Christoph Hellwig
2025-11-10 18:04   ` Darrick J. Wong
2025-11-10 13:22 ` [PATCH 04/18] xfs: remove xfs_dqunlock and friends Christoph Hellwig
2025-11-10 13:22 ` [PATCH 05/18] xfs: use a lockref for the xfs_dquot reference count Christoph Hellwig
2025-11-10 13:22 ` [PATCH 06/18] xfs: remove xfs_qm_dqput and optimize dropping dquot references Christoph Hellwig
2025-11-10 18:12   ` Darrick J. Wong
2025-11-10 13:22 ` [PATCH 07/18] xfs: consolidate q_qlock locking in xfs_qm_dqget and xfs_qm_dqget_inode Christoph Hellwig
2025-11-10 13:23 ` [PATCH 08/18] xfs: xfs_qm_dqattach_one is never called with a non-NULL *IO_idqpp Christoph Hellwig
2025-11-10 13:23 ` [PATCH 09/18] xfs: fold xfs_qm_dqattach_one into xfs_qm_dqget_inode Christoph Hellwig
2025-11-10 13:23 ` [PATCH 10/18] xfs: return the dquot unlocked from xfs_qm_dqget Christoph Hellwig
2025-11-10 13:23 ` [PATCH 11/18] xfs: remove q_qlock locking in xfs_qm_scall_setqlim Christoph Hellwig
2025-11-10 13:23 ` Christoph Hellwig [this message]
2025-11-10 13:23 ` [PATCH 13/18] xfs: move q_qlock locking into xchk_quota_item Christoph Hellwig
2025-11-10 13:23 ` [PATCH 14/18] xfs: move q_qlock locking into xqcheck_compare_dquot Christoph Hellwig
2025-11-10 18:13   ` Darrick J. Wong
2025-11-10 13:23 ` [PATCH 15/18] xfs: move quota locking into xqcheck_commit_dquot Christoph Hellwig
2025-11-10 18:13   ` Darrick J. Wong
2025-11-10 13:23 ` [PATCH 16/18] xfs: move quota locking into xrep_quota_item Christoph Hellwig
2025-11-10 18:14   ` Darrick J. Wong
2025-11-10 13:23 ` [PATCH 17/18] xfs: move xfs_dquot_tree calls into xfs_qm_dqget_cache_{lookup,insert} Christoph Hellwig
2025-11-10 13:23 ` [PATCH 18/18] xfs: reduce ilock roundtrips in xfs_qm_vop_dqalloc Christoph Hellwig
2025-11-10 18:19   ` Darrick J. Wong
2025-11-11  8:54     ` Christoph Hellwig
2025-11-11 11:00 ` cleanup quota locking v2 Carlos Maiolino

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=20251110132335.409466-13-hch@lst.de \
    --to=hch@lst.de \
    --cc=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).