gfs2: Fix initial quota data refcount

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>
This commit is contained in:
Andreas Gruenbacher 2023-08-24 14:52:29 +02:00
parent fae2e73a55
commit bb73ae8ff3
1 changed files with 2 additions and 1 deletions

View File

@ -228,7 +228,7 @@ static struct gfs2_quota_data *qd_alloc(unsigned hash, struct gfs2_sbd *sdp, str
return NULL; return NULL;
qd->qd_sbd = sdp; qd->qd_sbd = sdp;
qd->qd_lockref.count = 1; qd->qd_lockref.count = 0;
spin_lock_init(&qd->qd_lockref.lock); spin_lock_init(&qd->qd_lockref.lock);
qd->qd_id = qid; qd->qd_id = qid;
qd->qd_slot = -1; qd->qd_slot = -1;
@ -290,6 +290,7 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid,
spin_lock_bucket(hash); spin_lock_bucket(hash);
*qdp = qd = gfs2_qd_search_bucket(hash, sdp, qid); *qdp = qd = gfs2_qd_search_bucket(hash, sdp, qid);
if (qd == NULL) { if (qd == NULL) {
new_qd->qd_lockref.count++;
*qdp = new_qd; *qdp = new_qd;
list_add(&new_qd->qd_list, &sdp->sd_quota_list); list_add(&new_qd->qd_list, &sdp->sd_quota_list);
hlist_bl_add_head_rcu(&new_qd->qd_hlist, &qd_hash_table[hash]); hlist_bl_add_head_rcu(&new_qd->qd_hlist, &qd_hash_table[hash]);