This is a note to let you know that I've just added the patch titled gfs2: fix scheduling while atomic bug in glocks to the 5.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: gfs2-fix-scheduling-while-atomic-bug-in-glocks.patch and it can be found in the queue-5.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 20265d9a67e40eafd39a8884658ca2e36f05985d Mon Sep 17 00:00:00 2001 From: Bob Peterson <rpeterso@xxxxxxxxxx> Date: Tue, 18 May 2021 09:12:10 -0400 Subject: gfs2: fix scheduling while atomic bug in glocks From: Bob Peterson <rpeterso@xxxxxxxxxx> commit 20265d9a67e40eafd39a8884658ca2e36f05985d upstream. Before this patch, in the unlikely event that gfs2_glock_dq encountered a withdraw, it would do a wait_on_bit to wait for its journal to be recovered, but it never released the glock's spin_lock, which caused a scheduling-while-atomic error. This patch unlocks the lockref spin_lock before waiting for recovery. Fixes: 601ef0d52e96 ("gfs2: Force withdraw to replay journals and wait for it to finish") Cc: stable@xxxxxxxxxxxxxxx # v5.7+ Reported-by: Alexander Aring <aahringo@xxxxxxxxxx> Signed-off-by: Bob Peterson <rpeterso@xxxxxxxxxx> Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/gfs2/glock.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1465,9 +1465,11 @@ void gfs2_glock_dq(struct gfs2_holder *g glock_blocked_by_withdraw(gl) && gh->gh_gl != sdp->sd_jinode_gl) { sdp->sd_glock_dqs_held++; + spin_unlock(&gl->gl_lockref.lock); might_sleep(); wait_on_bit(&sdp->sd_flags, SDF_WITHDRAW_RECOVERY, TASK_UNINTERRUPTIBLE); + spin_lock(&gl->gl_lockref.lock); } if (gh->gh_flags & GL_NOCACHE) handle_callback(gl, LM_ST_UNLOCKED, 0, false); Patches currently in stable-queue which might be from rpeterso@xxxxxxxxxx are queue-5.12/gfs2-fix-scheduling-while-atomic-bug-in-glocks.patch