gfs2: fix withdraw after SDF_JOURNAL_LIVE clearing
Andreas Gruenbacher
maintainerPATCH 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
@@ -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
[email protected]
AI reviewThank 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_LIVEclearingRight now, we can end up with the following sequence of events: the log is non-empty when
__gfs2_log_flush()clears theSDF_JOURNAL_LIVEflag, the filesystem is withdrawn,do_withdraw()doesn't wait for the log to clear because it sees that theSDF_JOURNAL_LIVEflag 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_LIVEflag is no longer set indo_withdraw().Signed-off-by Andreas Gruenbacher <[email protected]>
[Severity: Low]
Since this fixes the early return on !test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags) in do_withdraw(), should it include:
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1