From: Jiaming Zhang <r772577952@gmail.com>
To: Andreas Gruenbacher <agruenba@redhat.com>, gfs2@lists.linux.dev
Cc: linux-kernel@vger.kernel.org, syzkaller@googlegroups.com,
Jiaming Zhang <r772577952@gmail.com>
Subject: [PATCH RESEND] gfs2: stop logd and quotad before kill_sb log flush
Date: Mon, 31 Aug 2026 21:06:43 +0800 [thread overview]
Message-ID: <20260831130643.780514-1-r772577952@gmail.com> (raw)
gfs2_kill_sb() issues a synchronous log flush before stopping the gfs2_logd and
gfs2_quotad kthreads. Given a corrupted filesystem image, that flush can spend a
long time while holding sd_log_flush_lock. Since the background threads are
still alive at that point, gfs2_logd can be woken and block on sd_log_flush_lock
in gfs2_logd(), and gfs2_quotad can block on the same lock through
gfs2_statfs_sync() -> __gfs2_trans_begin(). The threads can then remain in
uninterruptible sleep long enough to trigger the hung task.
Stop the background threads before the kill_sb log flush. gfs2_destroy_threads()
waits for both kthreads to exit via kthread_stop_put(), so after it returns
there is no live logd or quotad thread that can wait behind sd_log_flush_lock.
Closes: https://lore.kernel.org/lkml/CANypQFasb8voDrg=O9xJikYHdRFeupb5VP2VeJaZ_wFNMoGr2Q@mail.gmail.com/
Assisted-by: Codex:gpt-5.5-xhigh
Signed-off-by: Jiaming Zhang <r772577952@gmail.com>
---
fs/gfs2/ops_fstype.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 718e0da7dfce..65c536fffefd 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1777,6 +1777,8 @@ static void gfs2_kill_sb(struct super_block *sb)
return;
}
+ gfs2_destroy_threads(sdp);
+
gfs2_log_flush(sdp, NULL, GFS2_LOG_HEAD_FLUSH_SYNC | GFS2_LFC_KILL_SB);
dput(sdp->sd_root_dir);
dput(sdp->sd_master_dir);
--
2.43.0
reply other threads:[~2026-08-31 13:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260831130643.780514-1-r772577952@gmail.com \
--to=r772577952@gmail.com \
--cc=agruenba@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox