gfs2: Fix invalid glock target state during withdraw
PATCH 1/1 gfs2: Fix invalid glock target state during withdraw
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 [email protected]
Signed-off-by cestbonchen <[email protected]>
--- fs/gfs2/glock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/gfs2/glock.c +2 -2
@@ -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 {
Signature · 1 line
2.43.0