GFS2: Fix locking bug in failed shared to exclusive conversion
authorBenjamin Marzinski <bmarzins@redhat.com>
Fri, 6 Mar 2009 16:03:20 +0000 (10:03 -0600)
committerSteven Whitehouse <steve@dolmen.chygwyn.com>
Tue, 24 Mar 2009 11:21:26 +0000 (11:21 +0000)
commit02ffad08e838997fad3de05c85560a57e5fd92de
treefeee17b1848957b1b42047ae6c4156d716adf4e8
parent229615def3f573fc448d20f62c6ec1bc9340cefb
GFS2: 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>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/incore.h
fs/gfs2/lock_dlm.c