cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [GFS2 PATCH] GFS2: Adjust lock reference count
       [not found] <1359995163.13170063.1394634617177.JavaMail.zimbra@redhat.com>
@ 2014-03-12 14:32 ` Bob Peterson
  2014-03-12 14:47   ` Steven Whitehouse
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Peterson @ 2014-03-12 14:32 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

This patch closes a small timing window whereby a request to hold the
transaction glock can get stuck. The problem is that after the DLM has
granted the lock, it can get into a state whereby it doesn't transition
the glock to a held state, due to not having requeued the glock state
machine to finish the transition.

Steve: Feel free to adjust the patch description as you see fit.
I'm not feeling very creative at the moment.

Regards,

Bob Peterson
Red Hat File Systems

Signed-off-by: Bob Peterson <rpeterso@redhat.com> 
---
 fs/gfs2/glock.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 52f7478..67ac456 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -1047,9 +1047,13 @@ int gfs2_glock_nq(struct gfs2_holder *gh)
 
 	spin_lock(&gl->gl_spin);
 	add_to_queue(gh);
-	if ((LM_FLAG_NOEXP & gh->gh_flags) &&
-	    test_and_clear_bit(GLF_FROZEN, &gl->gl_flags))
+	if (unlikely((LM_FLAG_NOEXP & gh->gh_flags) &&
+		     test_and_clear_bit(GLF_FROZEN, &gl->gl_flags))) {
 		set_bit(GLF_REPLY_PENDING, &gl->gl_flags);
+		atomic_inc(&gl->gl_ref);
+		if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
+			atomic_dec(&gl->gl_ref);
+	}
 	run_queue(gl, 1);
 	spin_unlock(&gl->gl_spin);
 



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Cluster-devel] [GFS2 PATCH] GFS2: Adjust lock reference count
  2014-03-12 14:32 ` [Cluster-devel] [GFS2 PATCH] GFS2: Adjust lock reference count Bob Peterson
@ 2014-03-12 14:47   ` Steven Whitehouse
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2014-03-12 14:47 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi,

On Wed, 2014-03-12 at 10:32 -0400, Bob Peterson wrote:
> Hi,
> 
> This patch closes a small timing window whereby a request to hold the
> transaction glock can get stuck. The problem is that after the DLM has
> granted the lock, it can get into a state whereby it doesn't transition
> the glock to a held state, due to not having requeued the glock state
> machine to finish the transition.
> 
> Steve: Feel free to adjust the patch description as you see fit.
> I'm not feeling very creative at the moment.
> 
> Regards,
> 
> Bob Peterson
> Red Hat File Systems
> 
I updated the description, and also converted the atomic_inc to lockref
- I guess that you didn't compile test this one. Anyway, that should
sort it out I think, so I've added it to the tree now, since we know
that the fix is needed,

Steve.

> Signed-off-by: Bob Peterson <rpeterso@redhat.com> 
> ---
>  fs/gfs2/glock.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> index 52f7478..67ac456 100644
> --- a/fs/gfs2/glock.c
> +++ b/fs/gfs2/glock.c
> @@ -1047,9 +1047,13 @@ int gfs2_glock_nq(struct gfs2_holder *gh)
>  
>  	spin_lock(&gl->gl_spin);
>  	add_to_queue(gh);
> -	if ((LM_FLAG_NOEXP & gh->gh_flags) &&
> -	    test_and_clear_bit(GLF_FROZEN, &gl->gl_flags))
> +	if (unlikely((LM_FLAG_NOEXP & gh->gh_flags) &&
> +		     test_and_clear_bit(GLF_FROZEN, &gl->gl_flags))) {
>  		set_bit(GLF_REPLY_PENDING, &gl->gl_flags);
> +		atomic_inc(&gl->gl_ref);
> +		if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
> +			atomic_dec(&gl->gl_ref);
> +	}
>  	run_queue(gl, 1);
>  	spin_unlock(&gl->gl_spin);
>  
> 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-12 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1359995163.13170063.1394634617177.JavaMail.zimbra@redhat.com>
2014-03-12 14:32 ` [Cluster-devel] [GFS2 PATCH] GFS2: Adjust lock reference count Bob Peterson
2014-03-12 14:47   ` Steven Whitehouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).