From: cestbonchen <cestbonchen@163.com>
To: agruenba@redhat.com
Cc: gfs2@lists.linux.dev, linux-kernel@vger.kernel.org,
syzkaller@googlegroups.com, cestbonchen <cestbonchen@163.com>,
syzbot+353de08f32ce69361b89@syzkaller.appspotmail.com
Subject: [PATCH] gfs2: Fix invalid glock target state during withdraw
Date: Sat, 1 Nov 2025 23:35:03 +0800 [thread overview]
Message-ID: <20251101153503.6019-1-cestbonchen@163.com> (raw)
During filesystem withdraw, do_xmote() may set the glock target state
to LM_OUT_ERROR when the intended target is not LM_ST_UNLOCKED.
However, LM_OUT_ERROR is an operation result code, not a valid DLM lock
state. Passing it to finish_xmote() triggers a kernel BUG at
fs/gfs2/glock.c:674 due to an invalid state transition.
The correct behavior during withdraw is to force the target state to
LM_ST_UNLOCKED, which safely invalidates cached data via ->go_inval()
and avoids further DLM operations.
Fix both the general withdraw path and the -ENODEV error handling path.
Fixes: 669d4eb0b918 ("gfs2: Clean up properly during a withdraw")
Reported-by: syzbot+353de08f32ce69361b89@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?id=f9cc39ae87e4716a6309e8f5d558432cd90035ac
Signed-off-by: cestbonchen <cestbonchen@163.com>
---
fs/gfs2/glock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index e19aa2e820c8..fb08660567ed 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -696,7 +696,7 @@ __acquires(&gl->gl_lockref.lock)
skip_inval:
if (gfs2_withdrawn(sdp)) {
if (target != LM_ST_UNLOCKED)
- target = LM_OUT_ERROR;
+ target = LM_ST_UNLOCKED;
goto out;
}
@@ -719,7 +719,7 @@ __acquires(&gl->gl_lockref.lock)
* been unlocked implicitly.
*/
if (target != LM_ST_UNLOCKED) {
- target = LM_OUT_ERROR;
+ target = LM_ST_UNLOCKED;
goto out;
}
} else {
--
2.43.0
reply other threads:[~2025-11-01 15:35 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=20251101153503.6019-1-cestbonchen@163.com \
--to=cestbonchen@163.com \
--cc=agruenba@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+353de08f32ce69361b89@syzkaller.appspotmail.com \
--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
all inboxes | Powered by JetHome®