Skip to content

Commit d9612c6

Browse files
Andreas Gruenbachergregkh
authored andcommitted
gfs2: Revert "Add quota_change type"
[ Upstream commit ec4b520 ] Commit 432928c ("gfs2: Add quota_change type") makes the incorrect assertion that function do_qc() should behave differently in the two contexts it is used in, but that isn't actually true. In all cases, do_qc() grabs a "reference" when it starts using a slot in the per-node quota changes file, and it releases that "reference" when no more residual changes remain. Revert that broken commit. There are some remaining issues with function do_qc() which are addressed in the next commit. This reverts commit 432928c. Signed-off-by: Andreas Gruenbacher <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent d93a2f8 commit d9612c6

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

fs/gfs2/quota.c

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@
7575
#define GFS2_QD_HASH_SIZE BIT(GFS2_QD_HASH_SHIFT)
7676
#define GFS2_QD_HASH_MASK (GFS2_QD_HASH_SIZE - 1)
7777

78-
#define QC_CHANGE 0
79-
#define QC_SYNC 1
80-
8178
/* Lock order: qd_lock -> bucket lock -> qd->lockref.lock -> lru lock */
8279
/* -> sd_bitmap_lock */
8380
static DEFINE_SPINLOCK(qd_lock);
@@ -697,7 +694,7 @@ static int sort_qd(const void *a, const void *b)
697694
return 0;
698695
}
699696

700-
static void do_qc(struct gfs2_quota_data *qd, s64 change, int qc_type)
697+
static void do_qc(struct gfs2_quota_data *qd, s64 change)
701698
{
702699
struct gfs2_sbd *sdp = qd->qd_sbd;
703700
struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
@@ -722,18 +719,16 @@ static void do_qc(struct gfs2_quota_data *qd, s64 change, int qc_type)
722719
qd->qd_change = x;
723720
spin_unlock(&qd_lock);
724721

725-
if (qc_type == QC_CHANGE) {
726-
if (!test_and_set_bit(QDF_CHANGE, &qd->qd_flags)) {
727-
qd_hold(qd);
728-
slot_hold(qd);
729-
}
730-
} else {
722+
if (!x) {
731723
gfs2_assert_warn(sdp, test_bit(QDF_CHANGE, &qd->qd_flags));
732724
clear_bit(QDF_CHANGE, &qd->qd_flags);
733725
qc->qc_flags = 0;
734726
qc->qc_id = 0;
735727
slot_put(qd);
736728
qd_put(qd);
729+
} else if (!test_and_set_bit(QDF_CHANGE, &qd->qd_flags)) {
730+
qd_hold(qd);
731+
slot_hold(qd);
737732
}
738733

739734
if (change < 0) /* Reset quiet flag if we freed some blocks */
@@ -978,7 +973,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
978973
if (error)
979974
goto out_end_trans;
980975

981-
do_qc(qd, -qd->qd_change_sync, QC_SYNC);
976+
do_qc(qd, -qd->qd_change_sync);
982977
set_bit(QDF_REFRESH, &qd->qd_flags);
983978
}
984979

@@ -1300,7 +1295,7 @@ void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
13001295

13011296
if (qid_eq(qd->qd_id, make_kqid_uid(uid)) ||
13021297
qid_eq(qd->qd_id, make_kqid_gid(gid))) {
1303-
do_qc(qd, change, QC_CHANGE);
1298+
do_qc(qd, change);
13041299
}
13051300
}
13061301
}

fs/gfs2/util.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
9999
*/
100100
int gfs2_freeze_lock_shared(struct gfs2_sbd *sdp)
101101
{
102+
int flags = LM_FLAG_NOEXP | GL_EXACT;
102103
int error;
103104

104-
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED,
105-
LM_FLAG_NOEXP | GL_EXACT,
105+
error = gfs2_glock_nq_init(sdp->sd_freeze_gl, LM_ST_SHARED, flags,
106106
&sdp->sd_freeze_gh);
107-
if (error)
107+
if (error && error != GLR_TRYFAILED)
108108
fs_err(sdp, "can't lock the freeze glock: %d\n", error);
109109
return error;
110110
}

0 commit comments

Comments
 (0)