Skip to content

Commit 20265d9

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: fix scheduling while atomic bug in glocks
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: 601ef0d ("gfs2: Force withdraw to replay journals and wait for it to finish") Cc: [email protected] # v5.7+ Reported-by: Alexander Aring <[email protected]> Signed-off-by: Bob Peterson <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 4194dec commit 20265d9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/gfs2/glock.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,9 +1466,11 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
14661466
glock_blocked_by_withdraw(gl) &&
14671467
gh->gh_gl != sdp->sd_jinode_gl) {
14681468
sdp->sd_glock_dqs_held++;
1469+
spin_unlock(&gl->gl_lockref.lock);
14691470
might_sleep();
14701471
wait_on_bit(&sdp->sd_flags, SDF_WITHDRAW_RECOVERY,
14711472
TASK_UNINTERRUPTIBLE);
1473+
spin_lock(&gl->gl_lockref.lock);
14721474
}
14731475
if (gh->gh_flags & GL_NOCACHE)
14741476
handle_callback(gl, LM_ST_UNLOCKED, 0, false);

0 commit comments

Comments
 (0)