[PATCH] gfs2: drain withdraw work after making filesystem read-only

From: Matheus Alves de Almeida

Date: Fri Oct 09 2026 - 00:00:44 EST


Currently, gfs2_put_super() drains withdraw work before making the
filesystem read-only. A journal write I/O error could enqueue more
work, which does not get drained before releasing filesystem data.

Flush any pending withdraw work after gfs2_make_fs_ro() in
gfs2_put_super().

Reported-by: syzbot+88ffc513fdcbbb39cdf7@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=88ffc513fdcbbb39cdf7
Fixes: f458aafc5c21 ("gfs2: wait for withdraw earlier during unmount")
Signed-off-by: Matheus Alves de Almeida <matheus.aalmeida@xxxxxxxxxxxx>
---
fs/gfs2/super.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index 06302c293..45260280a 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -599,9 +599,14 @@ static void gfs2_put_super(struct super_block *sb)
/* Wait for withdraw to complete */
flush_work(&sdp->sd_withdraw_work);

- if (!sb_rdonly(sb))
+ if (!sb_rdonly(sb)) {
gfs2_make_fs_ro(sdp);
- else {
+ /*
+ * A journal I/O error during gfs2_make_fs_ro() may queue
+ * withdraw work.
+ */
+ flush_work(&sdp->sd_withdraw_work);
+ } else {
if (gfs2_withdrawn(sdp))
gfs2_destroy_threads(sdp);

--
2.43.0