提交 152393bd 编写于 作者: B Bob Peterson 提交者: Zheng Zengkai

gfs2: fix scheduling while atomic bug in glocks

stable inclusion
from stable-5.10.43
commit d11e5b96efde861e6c753c15e694f3ee34e7a513
bugzilla: 109284
CVE: NA

--------------------------------

commit 20265d9a 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: 601ef0d5 ("gfs2: Force withdraw to replay journals and wait for it to finish")
Cc: stable@vger.kernel.org # v5.7+
Reported-by: NAlexander Aring <aahringo@redhat.com>
Signed-off-by: NBob Peterson <rpeterso@redhat.com>
Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 7e7b3394
...@@ -1457,9 +1457,11 @@ void gfs2_glock_dq(struct gfs2_holder *gh) ...@@ -1457,9 +1457,11 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
glock_blocked_by_withdraw(gl) && glock_blocked_by_withdraw(gl) &&
gh->gh_gl != sdp->sd_jinode_gl) { gh->gh_gl != sdp->sd_jinode_gl) {
sdp->sd_glock_dqs_held++; sdp->sd_glock_dqs_held++;
spin_unlock(&gl->gl_lockref.lock);
might_sleep(); might_sleep();
wait_on_bit(&sdp->sd_flags, SDF_WITHDRAW_RECOVERY, wait_on_bit(&sdp->sd_flags, SDF_WITHDRAW_RECOVERY,
TASK_UNINTERRUPTIBLE); TASK_UNINTERRUPTIBLE);
spin_lock(&gl->gl_lockref.lock);
} }
if (gh->gh_flags & GL_NOCACHE) if (gh->gh_flags & GL_NOCACHE)
handle_callback(gl, LM_ST_UNLOCKED, 0, false); handle_callback(gl, LM_ST_UNLOCKED, 0, false);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
新手
引导
客服 返回
顶部