[PATCH AUTOSEL 6.18-6.12] gfs2: move quota_init qc iterator increment

From: Sasha Levin

Date: Mon Aug 31 2026 - 16:29:41 EST


From: Jie Wang <jie.wang@xxxxxxxxx>

[ Upstream commit 942202677f8f2ee448a6a2feb06aeeaf520342e3 ]

Move qc++ from the loop body into the for-loop increment
expression in gfs2_quota_init().

This keeps iterator progression explicit and avoids mixing pointer
advance with duplicate-slot handling in the loop body.

Signed-off-by: Jie Wang <jie.wang@xxxxxxxxx>
Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---

LLM Generated explanations, may be completely bogus:

The background `git log -S` search between v6.10 and v6.11 finished
(~75s) but only surfaced merge/release commits, not the actual GFS2
change — typical for this shallow stable checkout.

What we could pin down: duplicate-slot zeroing first appears in
**v6.11** (absent in v6.10, present in v6.11), so the `qc++` /
`memset(qc)` ordering bug has been in 6.18.y since then. That’s enough
context for the **YES** backport call; the exact introducing SHA isn’t
available from this tree’s history.

fs/gfs2/quota.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 7a36a3fe5e6e6..4620f586411a6 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1447,7 +1447,7 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)

qc = (struct gfs2_quota_change *)(bh->b_data + sizeof(struct gfs2_meta_header));
for (y = 0; y < sdp->sd_qc_per_block && slot < sdp->sd_quota_slots;
- y++, slot++) {
+ y++, slot++, qc++) {
struct gfs2_quota_data *old_qd, *qd;
s64 qc_change = be64_to_cpu(qc->qc_change);
u32 qc_flags = be32_to_cpu(qc->qc_flags);
@@ -1455,7 +1455,6 @@ int gfs2_quota_init(struct gfs2_sbd *sdp)
USRQUOTA : GRPQUOTA;
struct kqid qc_id = make_kqid(&init_user_ns, qtype,
be32_to_cpu(qc->qc_id));
- qc++;
if (!qc_change)
continue;

--
2.53.0