[PATCH AUTOSEL 6.18-6.12] gfs2: Fix "gfs2: Switch to wait_event in gfs2_quotad"

Sasha Levin <[email protected]>
Newsgroups dev.linux.lists.gfs2,dev.linux.lists.patches,org.kernel.vger.stable
Message-ID <[email protected]>
From: Andreas Gruenbacher <[email protected]>

[ Upstream commit dff1fb6d8b7abe5b1119fa060f5d6b3370bf10ac ]

Commit e4a8b5481c59a ("gfs2: Switch to wait_event in gfs2_quotad") broke
cyclic statfs syncing, so the numbers reported by "df" could easily get
completely out of sync with reality.  Fix this by reverting part of
commit e4a8b5481c59a for now.

A follow-up commit will clean this code up later.

Signed-off-by: Andreas Gruenbacher <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
---

LLM Generated explanations, may be completely bogus:

### 7. STABILITY INDICATORS

- **Author**: Andreas Gruenbacher (GFS2 maintainer) - same person who
  introduced the bug
- **Fix type**: Partial revert - restores known-working behavior
- **Commit message**: Clear acknowledgment of the problem and solution
- **Testing**: Maintainer would have verified the fix given the severity

### Summary Assessment

| Criteria | Assessment |
|----------|------------|
| Fixes real bug | ✅ Yes - broken statfs sync breaks "df" reporting |
| Obviously correct | ✅ Yes - single character change restoring original
logic |
| Small and contained | ✅ Yes - 1 character change in 1 file |
| No new features | ✅ Yes - pure regression fix |
| User impact | HIGH - affects all GFS2 users |
| Risk | VERY LOW - restores proven behavior |
| Dependencies | Needs commit e4a8b5481c59a (in 6.6+) |

### Conclusion

This commit is an excellent candidate for stable backport:

1. **Fixes a real, user-visible bug**: Disk usage reporting being
   "completely out of sync with reality" is a serious issue for any
   filesystem.

2. **Minimal, surgical fix**: A single character change (`=` → `-=`)
   with zero risk of collateral damage.

3. **Restores original behavior**: This is a partial revert, returning
   to the proven timing logic that worked before the buggy conversion.

4. **Critical subsystem**: GFS2 is a clustered filesystem used in
   enterprise environments where correct disk space reporting is
   essential.

5. **Clear provenance**: Written by the GFS2 maintainer who introduced
   the original bug, so he understands exactly what went wrong.

The only consideration is that this fix requires the buggy commit
e4a8b5481c59a to be present (v6.6+). For stable trees 6.6.y and later,
this fix should be backported.

**YES**

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

diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 2298e06797ac3..f2df01f801b81 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1616,7 +1616,7 @@ int gfs2_quotad(void *data)
 
 		t = min(quotad_timeo, statfs_timeo);
 
-		t = wait_event_freezable_timeout(sdp->sd_quota_wait,
+		t -= wait_event_freezable_timeout(sdp->sd_quota_wait,
 				sdp->sd_statfs_force_sync ||
 				gfs2_withdrawing_or_withdrawn(sdp) ||
 				kthread_should_stop(),
-- 
2.51.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.