Skip to content

Commit 5589eba

Browse files
committed
gfs2: Fix request cancelation bug
jira LE-12345 Rebuild_History Non-Buildable kernel-5.14.0-570.12.1.el9_6 commit-author Andreas Gruenbacher <agruenba@redhat.com> commit a431d49 In finish_xmote(), when a locking request is canceled, the corresponding holder is moved to the tail of the holders list instead of being dequeued immediately. When there is only a single holder, the canceled locking request is then immediately repeated. This makes no sense; it looks like another remnant of LM_FLAG_PRIORITY support. Instead, dequeue canceled holders and proceed with the next holder in finish_xmote(). We can then easily detect in gfs2_glock_dq() when a holder has been canceled. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> (cherry picked from commit a431d49) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent ddae25a commit 5589eba

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

fs/gfs2/glock.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -608,14 +608,19 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
608608
if (gh && (ret & LM_OUT_CANCELED))
609609
gfs2_holder_wake(gh);
610610
if (gh && !test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)) {
611-
/* move to back of queue and try next entry */
612611
if (ret & LM_OUT_CANCELED) {
613-
list_move_tail(&gh->gh_list, &gl->gl_holders);
612+
list_del_init(&gh->gh_list);
613+
trace_gfs2_glock_queue(gh, 0);
614+
gl->gl_target = gl->gl_state;
614615
gh = find_first_waiter(gl);
615-
gl->gl_target = gh->gh_state;
616-
if (do_promote(gl))
617-
goto out;
618-
goto retry;
616+
if (gh) {
617+
gl->gl_target = gh->gh_state;
618+
if (do_promote(gl))
619+
goto out;
620+
do_xmote(gl, gh, gl->gl_target);
621+
return;
622+
}
623+
goto out;
619624
}
620625
/* Some error or failed "try lock" - report it */
621626
if ((ret & LM_OUT_ERROR) ||
@@ -628,7 +633,6 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
628633
switch(state) {
629634
/* Unlocked due to conversion deadlock, try again */
630635
case LM_ST_UNLOCKED:
631-
retry:
632636
do_xmote(gl, gh, gl->gl_target);
633637
break;
634638
/* Conversion fails, unlock and try again */
@@ -1672,6 +1676,8 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
16721676
gl->gl_name.ln_sbd->sd_lockstruct.ls_ops->lm_cancel(gl);
16731677
wait_on_bit(&gh->gh_iflags, HIF_WAIT, TASK_UNINTERRUPTIBLE);
16741678
spin_lock(&gl->gl_lockref.lock);
1679+
if (!gfs2_holder_queued(gh))
1680+
goto out;
16751681
}
16761682

16771683
/*

0 commit comments

Comments
 (0)