aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/lock_dlm.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2011-03-09 05:58:04 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2011-03-09 05:58:04 -0500
commitfc0e38dae645f65424d1fb5d2a938aab8ce48a58 (patch)
tree8b0a89a0de01a0504a002a184a290a53545fce82 /fs/gfs2/lock_dlm.c
parent662e3a551b468c7338f5291d7a00389fe85885e2 (diff)
GFS2: Fix glock deallocation race
This patch fixes a race in deallocating glocks which was introduced in the RCU glock patch. We need to ensure that the glock count is kept correct even in the case that there is a race to add a new glock into the hash table. Also, to avoid having to wait for an RCU grace period, the glock counter can be decremented before call_rcu() is called. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/lock_dlm.c')
-rw-r--r--fs/gfs2/lock_dlm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index c80485cb6f25..98c80d8c2a62 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -30,7 +30,7 @@ static void gdlm_ast(void *arg)
30 30
31 switch (gl->gl_lksb.sb_status) { 31 switch (gl->gl_lksb.sb_status) {
32 case -DLM_EUNLOCK: /* Unlocked, so glock can be freed */ 32 case -DLM_EUNLOCK: /* Unlocked, so glock can be freed */
33 call_rcu(&gl->gl_rcu, gfs2_glock_free); 33 gfs2_glock_free(gl);
34 return; 34 return;
35 case -DLM_ECANCEL: /* Cancel while getting lock */ 35 case -DLM_ECANCEL: /* Cancel while getting lock */
36 ret |= LM_OUT_CANCELED; 36 ret |= LM_OUT_CANCELED;
@@ -165,7 +165,7 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
165 int error; 165 int error;
166 166
167 if (gl->gl_lksb.sb_lkid == 0) { 167 if (gl->gl_lksb.sb_lkid == 0) {
168 call_rcu(&gl->gl_rcu, gfs2_glock_free); 168 gfs2_glock_free(gl);
169 return; 169 return;
170 } 170 }
171 171