mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
gfs2: Fix request cancelation bug
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>
This commit is contained in:
parent
d838605fea
commit
a431d49243
1 changed files with 13 additions and 7 deletions
|
@ -607,14 +607,19 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
|
|||
if (gh && (ret & LM_OUT_CANCELED))
|
||||
gfs2_holder_wake(gh);
|
||||
if (gh && !test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)) {
|
||||
/* move to back of queue and try next entry */
|
||||
if (ret & LM_OUT_CANCELED) {
|
||||
list_move_tail(&gh->gh_list, &gl->gl_holders);
|
||||
list_del_init(&gh->gh_list);
|
||||
trace_gfs2_glock_queue(gh, 0);
|
||||
gl->gl_target = gl->gl_state;
|
||||
gh = find_first_waiter(gl);
|
||||
gl->gl_target = gh->gh_state;
|
||||
if (do_promote(gl))
|
||||
goto out;
|
||||
goto retry;
|
||||
if (gh) {
|
||||
gl->gl_target = gh->gh_state;
|
||||
if (do_promote(gl))
|
||||
goto out;
|
||||
do_xmote(gl, gh, gl->gl_target);
|
||||
return;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
/* Some error or failed "try lock" - report it */
|
||||
if ((ret & LM_OUT_ERROR) ||
|
||||
|
@ -627,7 +632,6 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
|
|||
switch(state) {
|
||||
/* Unlocked due to conversion deadlock, try again */
|
||||
case LM_ST_UNLOCKED:
|
||||
retry:
|
||||
do_xmote(gl, gh, gl->gl_target);
|
||||
break;
|
||||
/* Conversion fails, unlock and try again */
|
||||
|
@ -1672,6 +1676,8 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
|
|||
gl->gl_name.ln_sbd->sd_lockstruct.ls_ops->lm_cancel(gl);
|
||||
wait_on_bit(&gh->gh_iflags, HIF_WAIT, TASK_UNINTERRUPTIBLE);
|
||||
spin_lock(&gl->gl_lockref.lock);
|
||||
if (!gfs2_holder_queued(gh))
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue