Skip to content

Commit af4dec2

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 <agruenba@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5d73466 commit af4dec2

2 files changed

Lines changed: 10 additions & 15 deletions

File tree

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);
@@ -710,7 +707,7 @@ static int sort_qd(const void *a, const void *b)
710707
return 0;
711708
}
712709

713-
static void do_qc(struct gfs2_quota_data *qd, s64 change, int qc_type)
710+
static void do_qc(struct gfs2_quota_data *qd, s64 change)
714711
{
715712
struct gfs2_sbd *sdp = qd->qd_sbd;
716713
struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
@@ -735,18 +732,16 @@ static void do_qc(struct gfs2_quota_data *qd, s64 change, int qc_type)
735732
qd->qd_change = x;
736733
spin_unlock(&qd_lock);
737734

738-
if (qc_type == QC_CHANGE) {
739-
if (!test_and_set_bit(QDF_CHANGE, &qd->qd_flags)) {
740-
qd_hold(qd);
741-
slot_hold(qd);
742-
}
743-
} else {
735+
if (!x) {
744736
gfs2_assert_warn(sdp, test_bit(QDF_CHANGE, &qd->qd_flags));
745737
clear_bit(QDF_CHANGE, &qd->qd_flags);
746738
qc->qc_flags = 0;
747739
qc->qc_id = 0;
748740
slot_put(qd);
749741
qd_put(qd);
742+
} else if (!test_and_set_bit(QDF_CHANGE, &qd->qd_flags)) {
743+
qd_hold(qd);
744+
slot_hold(qd);
750745
}
751746

752747
if (change < 0) /* Reset quiet flag if we freed some blocks */
@@ -992,7 +987,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda)
992987
if (error)
993988
goto out_end_trans;
994989

995-
do_qc(qd, -qd->qd_change_sync, QC_SYNC);
990+
do_qc(qd, -qd->qd_change_sync);
996991
set_bit(QDF_REFRESH, &qd->qd_flags);
997992
}
998993

@@ -1312,7 +1307,7 @@ void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
13121307

13131308
if (qid_eq(qd->qd_id, make_kqid_uid(uid)) ||
13141309
qid_eq(qd->qd_id, make_kqid_gid(gid))) {
1315-
do_qc(qd, change, QC_CHANGE);
1310+
do_qc(qd, change);
13161311
}
13171312
}
13181313
}

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)