cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: cluster-devel@redhat.com
Subject: [Cluster-devel] [PATCH 8/9] gfs2: Fix initial quota data refcount
Date: Thu, 24 Aug 2023 23:19:47 +0200	[thread overview]
Message-ID: <20230824211948.3242607-9-agruenba@redhat.com> (raw)
In-Reply-To: <20230824211948.3242607-1-agruenba@redhat.com>

Fix the refcount of quota data objects created directly by
gfs2_quota_init(): those are placed into the in-memory quota "database"
for eventual syncing to the main quota file, but they are not actively
held and should thus have an initial refcount of 0.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/gfs2/quota.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index fccdb22980e8..97fdf64148ba 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -228,7 +228,7 @@ static struct gfs2_quota_data *qd_alloc(unsigned hash, struct gfs2_sbd *sdp, str
 		return NULL;
 
 	qd->qd_sbd = sdp;
-	qd->qd_lockref.count = 1;
+	qd->qd_lockref.count = 0;
 	spin_lock_init(&qd->qd_lockref.lock);
 	qd->qd_id = qid;
 	qd->qd_slot = -1;
@@ -290,6 +290,7 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid,
 	spin_lock_bucket(hash);
 	*qdp = qd = gfs2_qd_search_bucket(hash, sdp, qid);
 	if (qd == NULL) {
+		new_qd->qd_lockref.count++;
 		*qdp = new_qd;
 		list_add(&new_qd->qd_list, &sdp->sd_quota_list);
 		hlist_bl_add_head_rcu(&new_qd->qd_hlist, &qd_hash_table[hash]);
-- 
2.40.1


  parent reply	other threads:[~2023-08-24 21:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 21:19 [Cluster-devel] [PATCH 0/9] gfs2: quota cleanups and fixes Andreas Gruenbacher
2023-08-24 21:19 ` [Cluster-devel] [PATCH 1/9] gfs2: Use qd_sbd more consequently Andreas Gruenbacher
2023-08-24 21:19 ` [Cluster-devel] [PATCH 2/9] gfs2: Rename sd_{ glock => kill }_wait Andreas Gruenbacher
2023-08-24 21:19 ` [Cluster-devel] [PATCH 3/9] gfs2: Rename SDF_DEACTIVATING to SDF_KILL Andreas Gruenbacher
2023-08-24 21:19 ` [Cluster-devel] [PATCH 4/9] gfs2: Fix wrong quota shrinker return value Andreas Gruenbacher
2023-08-24 21:19 ` [Cluster-devel] [PATCH 5/9] gfs2: Use gfs2_qd_dispose in gfs2_quota_cleanup Andreas Gruenbacher
2023-08-24 21:19 ` [Cluster-devel] [PATCH 6/9] gfs2: Factor out duplicate quota data disposal code Andreas Gruenbacher
2023-08-24 21:19 ` [Cluster-devel] [PATCH 7/9] gfs2: No more quota complaints after withdraw Andreas Gruenbacher
2023-08-24 21:19 ` Andreas Gruenbacher [this message]
2023-08-24 21:19 ` [Cluster-devel] [PATCH 9/9] gfs2: Fix quota data refcount after cleanup Andreas Gruenbacher

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=20230824211948.3242607-9-agruenba@redhat.com \
    --to=agruenba@redhat.com \
    --cc=cluster-devel@redhat.com \
    /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).