From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Whitehouse Date: Fri, 20 Jun 2014 15:18:03 +0100 Subject: [Cluster-devel] [GFS2 PATCH] GFS2: Only wait for demote when last holder is dequeued In-Reply-To: <546052074.1498359.1403271401430.JavaMail.zimbra@redhat.com> References: <546052074.1498359.1403271401430.JavaMail.zimbra@redhat.com> Message-ID: <53A4429B.9020604@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, Now in the -nmw tree. Thanks, Steve. On 20/06/14 14:36, Bob Peterson wrote: > Hi, > > 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. > > Regards, > > Bob Peterson > Red Hat File Systems > > Signed-off-by: Bob Peterson > --- > diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c > index aec7f73..22ce2f0 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); > } > > /** >