Skip to content

Commit 1fc05c8

Browse files
author
Andreas Gruenbacher
committed
gfs2: cancel timed-out glock requests
The gfs2 evict code tries to upgrade the iopen glock from SH to EX. If the attempt to upgrade times out, gfs2 needs to tell dlm to cancel the lock request or it can deadlock. We also need to wake up the process waiting for the lock when dlm sends its AST back to gfs2. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
1 parent a892b12 commit 1fc05c8

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

fs/gfs2/glock.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,8 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
669669

670670
/* Check for state != intended state */
671671
if (unlikely(state != gl->gl_target)) {
672+
if (gh && (ret & LM_OUT_CANCELED))
673+
gfs2_holder_wake(gh);
672674
if (gh && !test_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags)) {
673675
/* move to back of queue and try next entry */
674676
if (ret & LM_OUT_CANCELED) {
@@ -1691,6 +1693,14 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
16911693
struct gfs2_glock *gl = gh->gh_gl;
16921694

16931695
spin_lock(&gl->gl_lockref.lock);
1696+
if (list_is_first(&gh->gh_list, &gl->gl_holders) &&
1697+
!test_bit(HIF_HOLDER, &gh->gh_iflags)) {
1698+
spin_unlock(&gl->gl_lockref.lock);
1699+
gl->gl_name.ln_sbd->sd_lockstruct.ls_ops->lm_cancel(gl);
1700+
wait_on_bit(&gh->gh_iflags, HIF_WAIT, TASK_UNINTERRUPTIBLE);
1701+
spin_lock(&gl->gl_lockref.lock);
1702+
}
1703+
16941704
__gfs2_glock_dq(gh);
16951705
spin_unlock(&gl->gl_lockref.lock);
16961706
}

0 commit comments

Comments
 (0)