FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 03-06-2009, 03:03 PM
Benjamin Marzinski
 
Default Fix locking bug in failed shared to exclusive conversion

After calling out to the dlm, GFS2 sets the new state of a glock to
gl_target in gdlm_ast(). However, gl_target is not always the lock
state that was requested. If a conversion from shared to exclusive
fails, finish_xmote() will call do_xmote() with LM_ST_UNLOCKED, instead
of gl->gl_target, so that it can reacquire the lock in exlusive the next
time around. In this case, setting the lock to gl_target in gdlm_ast()
will make GFS2 think that it has the glock in exclusive mode, when
really, it doesn't have the glock locked at all. This patch adds a new
field to the gfs2_glock structure, gl_req, to track the mode that was
requested.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
fs/gfs2/incore.h | 1 +
fs/gfs2/lock_dlm.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)

Index: gfs2-2.6-nmw/fs/gfs2/incore.h
================================================== =================
--- gfs2-2.6-nmw.orig/fs/gfs2/incore.h
+++ gfs2-2.6-nmw/fs/gfs2/incore.h
@@ -203,6 +203,7 @@ struct gfs2_glock {
unsigned int gl_target;
unsigned int gl_reply;
unsigned int gl_hash;
+ unsigned int gl_req;
unsigned int gl_demote_state; /* state requested by remote node */
unsigned long gl_demote_time; /* time of first demote request */
struct list_head gl_holders;
Index: gfs2-2.6-nmw/fs/gfs2/lock_dlm.c
================================================== =================
--- gfs2-2.6-nmw.orig/fs/gfs2/lock_dlm.c
+++ gfs2-2.6-nmw/fs/gfs2/lock_dlm.c
@@ -46,11 +46,11 @@ static void gdlm_ast(void *arg)
BUG();
}

- ret = gl->gl_target;
+ ret = gl->gl_req;
if (gl->gl_lksb.sb_flags & DLM_SBF_ALTMODE) {
- if (gl->gl_target == LM_ST_SHARED)
+ if (gl->gl_req == LM_ST_SHARED)
ret = LM_ST_DEFERRED;
- else if (gl->gl_target == LM_ST_DEFERRED)
+ else if (gl->gl_req == LM_ST_DEFERRED)
ret = LM_ST_SHARED;
else
BUG();
@@ -147,6 +147,7 @@ static unsigned int gdlm_lock(struct gfs
int req;
u32 lkf;

+ gl->gl_req = req_state;
req = make_mode(req_state);
lkf = make_flags(gl->gl_lksb.sb_lkid, flags, req);
 
Old 03-06-2009, 03:06 PM
Steven Whitehouse
 
Default Fix locking bug in failed shared to exclusive conversion

Hi,

Now in the GFS2 -nmw git tree. This now means that we are ready to merge
the big lock module merge patch at the forthcoming merge window, so
thats really good news. Thanks,

Steve.

On Fri, 2009-03-06 at 10:03 -0600, Benjamin Marzinski wrote:
> After calling out to the dlm, GFS2 sets the new state of a glock to
> gl_target in gdlm_ast(). However, gl_target is not always the lock
> state that was requested. If a conversion from shared to exclusive
> fails, finish_xmote() will call do_xmote() with LM_ST_UNLOCKED, instead
> of gl->gl_target, so that it can reacquire the lock in exlusive the next
> time around. In this case, setting the lock to gl_target in gdlm_ast()
> will make GFS2 think that it has the glock in exclusive mode, when
> really, it doesn't have the glock locked at all. This patch adds a new
> field to the gfs2_glock structure, gl_req, to track the mode that was
> requested.
>
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
> fs/gfs2/incore.h | 1 +
> fs/gfs2/lock_dlm.c | 7 ++++---
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> Index: gfs2-2.6-nmw/fs/gfs2/incore.h
> ================================================== =================
> --- gfs2-2.6-nmw.orig/fs/gfs2/incore.h
> +++ gfs2-2.6-nmw/fs/gfs2/incore.h
> @@ -203,6 +203,7 @@ struct gfs2_glock {
> unsigned int gl_target;
> unsigned int gl_reply;
> unsigned int gl_hash;
> + unsigned int gl_req;
> unsigned int gl_demote_state; /* state requested by remote node */
> unsigned long gl_demote_time; /* time of first demote request */
> struct list_head gl_holders;
> Index: gfs2-2.6-nmw/fs/gfs2/lock_dlm.c
> ================================================== =================
> --- gfs2-2.6-nmw.orig/fs/gfs2/lock_dlm.c
> +++ gfs2-2.6-nmw/fs/gfs2/lock_dlm.c
> @@ -46,11 +46,11 @@ static void gdlm_ast(void *arg)
> BUG();
> }
>
> - ret = gl->gl_target;
> + ret = gl->gl_req;
> if (gl->gl_lksb.sb_flags & DLM_SBF_ALTMODE) {
> - if (gl->gl_target == LM_ST_SHARED)
> + if (gl->gl_req == LM_ST_SHARED)
> ret = LM_ST_DEFERRED;
> - else if (gl->gl_target == LM_ST_DEFERRED)
> + else if (gl->gl_req == LM_ST_DEFERRED)
> ret = LM_ST_SHARED;
> else
> BUG();
> @@ -147,6 +147,7 @@ static unsigned int gdlm_lock(struct gfs
> int req;
> u32 lkf;
>
> + gl->gl_req = req_state;
> req = make_mode(req_state);
> lkf = make_flags(gl->gl_lksb.sb_lkid, flags, req);
>
 

Thread Tools




All times are GMT. The time now is 09:36 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org