Skip to content

Commit bb73ae8

Browse files
author
Andreas Gruenbacher
committed
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>
1 parent fae2e73 commit bb73ae8

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/gfs2/quota.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static struct gfs2_quota_data *qd_alloc(unsigned hash, struct gfs2_sbd *sdp, str
228228
return NULL;
229229

230230
qd->qd_sbd = sdp;
231-
qd->qd_lockref.count = 1;
231+
qd->qd_lockref.count = 0;
232232
spin_lock_init(&qd->qd_lockref.lock);
233233
qd->qd_id = qid;
234234
qd->qd_slot = -1;
@@ -290,6 +290,7 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid,
290290
spin_lock_bucket(hash);
291291
*qdp = qd = gfs2_qd_search_bucket(hash, sdp, qid);
292292
if (qd == NULL) {
293+
new_qd->qd_lockref.count++;
293294
*qdp = new_qd;
294295
list_add(&new_qd->qd_list, &sdp->sd_quota_list);
295296
hlist_bl_add_head_rcu(&new_qd->qd_hlist, &qd_hash_table[hash]);

0 commit comments

Comments
 (0)