diff options
author | Bob Peterson <rpeterso@redhat.com> | 2014-06-20 17:36:41 +0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2014-07-18 14:12:14 +0400 |
commit | 79272b3562bb44ce7dc720cd13136f5a4a53c618 (patch) | |
tree | 7339b1d87039d77346d9a4ec3fb2be3316c6be81 /fs/gfs2 | |
parent | 3c8fb50445833b93f69b6b703a29aae3523cad0c (diff) | |
download | linux-79272b3562bb44ce7dc720cd13136f5a4a53c618.tar.xz |
GFS2: Only wait for demote when last holder is dequeued
Function gfs2_glock_dq_wait is supposed to dequeue a glock and then
wait for the lock to be demoted. The problem is, if this is a shared
lock, its demote will depend on the other holders, which means you
might end up waiting forever because the other process is blocked.
This problem is especially apparent when dealing with nested flocks.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/glock.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index c355f7320e44..278fae5b6982 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1128,7 +1128,9 @@ void gfs2_glock_dq_wait(struct gfs2_holder *gh) struct gfs2_glock *gl = gh->gh_gl; gfs2_glock_dq(gh); might_sleep(); - wait_on_bit(&gl->gl_flags, GLF_DEMOTE, gfs2_glock_demote_wait, TASK_UNINTERRUPTIBLE); + if (!find_first_holder(gl)) + wait_on_bit(&gl->gl_flags, GLF_DEMOTE, gfs2_glock_demote_wait, + TASK_UNINTERRUPTIBLE); } /** |