gfs2 filesystem and dlm development
 help / color / mirror / Atom feed
* [PATCH] gfs2: wait for bio in gfs2_write_log_header
@ 2026-11-26 22:44 Andreas Gruenbacher
  2026-11-26 22:55 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Gruenbacher @ 2026-11-26 22:44 UTC (permalink / raw)
  To: gfs2; +Cc: Andreas Gruenbacher

During journal recovery, clean_journal() calls gfs2_write_log_header(),
which allocates a page from gfs2_page_pool, puts that page in a bio, and
submits the bio.  If a subsequent step in gfs2_fill_super() fails after
journal replay, or a read-only mount that replayed a journal is
unmounted (where gfs2_put_super() skips gfs2_make_fs_ro()), the journal
glock can get dropped before the bio completes.  Also, if the module is
immediately removed, gfs2_page_pool can get destroyed before the page is
freed.

This very unlikely race was pointed out by Sashiko.

Fix by moving the call to log_flush_wait() from log_write_header() to
gfs2_write_log_header().

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/gfs2/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 1baaaf30c4fa..db40045ee2d0 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -908,6 +908,7 @@ void gfs2_write_log_header(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
 	gfs2_log_write(sdp, jd, page, sb->s_blocksize, 0, dblock,
 		       REQ_OP_WRITE | op_flags);
 	gfs2_log_submit_write(&jd->jd_log_bio);
+	log_flush_wait(sdp);
 }
 
 /**
@@ -935,7 +936,6 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags)
 			      sdp->sd_log_flush_tail, sdp->sd_log_flush_head,
 			      flags, op_flags);
 	gfs2_log_incr_head(sdp);
-	log_flush_wait(sdp);
 	log_pull_tail(sdp);
 	gfs2_log_update_head(sdp);
 }
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-26 22:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26 22:44 [PATCH] gfs2: wait for bio in gfs2_write_log_header Andreas Gruenbacher
2026-11-26 22:55 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox