Skip to contentSkip to conversation

gfs2: fix withdraw after SDF_JOURNAL_LIVE clearing

PATCH New Andreas Gruenbacher 2 participants 2 messages Dec 1 GFS2 file system

lore
Share & tools
lore

Andreas Gruenbacher

author maintainer
#0 lore raw

PATCH 1/1 gfs2: fix withdraw after SDF_JOURNAL_LIVE clearing

Right now, we can end up with the following sequence of events: the log is non-empty when __gfs2_log_flush() clears the SDF_JOURNAL_LIVE flag, the filesystem is withdrawn, do_withdraw() doesn't wait for the log to clear because it sees that the SDF_JOURNAL_LIVE flag isn't set, the filesystem is unmounted, gfs2_put_super() doesn't wait for the log to clear because it sees that the filesystem is already marked read-only, and it destroys the filesystem caches while objects in those caches are still active.

Fix that by waiting for the log to clear even when the SDF_JOURNAL_LIVE flag is no longer set in do_withdraw().

---
 fs/gfs2/util.c | 4 ----
 1 file changed, 4 deletions(-)
fs/gfs2/util.c +0 -4
index 529c3ec37a18..c20d84100b99 100644
@@ -117,10 +117,6 @@ void gfs2_freeze_unlock(struct gfs2_sbd *sdp)
 static void do_withdraw(struct gfs2_sbd *sdp)
 {
 	down_write(&sdp->sd_log_flush_lock);
-	if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
-		up_write(&sdp->sd_log_flush_lock);
-		return;
-	}
 	clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
 	gfs2_ail_drain(sdp); /* frees all transactions */
 	up_write(&sdp->sd_log_flush_lock);
Signature · 1 line
2.56.1
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] gfs2: missing Fixes trailer for commit 83348905e413 in do_withdraw() --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] gfs2: missing Fixes trailer for commit 83348905e413 in do_withdraw()
--

commit e8478a0e2bf9bcae7296c6bc3fd323129678af6e
Author: Andreas Gruenbacher <[email protected]>

Quoted 11 lines

gfs2: fix withdraw after SDF_JOURNAL_LIVE clearing

Right now, we can end up with the following sequence of events: the log is non-empty when __gfs2_log_flush() clears the SDF_JOURNAL_LIVE flag, the filesystem is withdrawn, do_withdraw() doesn't wait for the log to clear because it sees that the SDF_JOURNAL_LIVE flag isn't set, the filesystem is unmounted, gfs2_put_super() doesn't wait for the log to clear because it sees that the filesystem is already marked read-only, and it destroys the filesystem caches while objects in those caches are still active.

Quoted 4 lines

Fix that by waiting for the log to clear even when the SDF_JOURNAL_LIVE flag is no longer set in do_withdraw().

[Severity: Low]
Since this fixes the early return on !test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags) in do_withdraw(), should it include:

Fixes 83348905e413 ("gfs2: Clean up SDF_JOURNAL_LIVE flag handling")
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1