aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2006-03-29 21:24:12 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2006-04-07 20:37:52 -0400
commitf43e6918c0e3906fd4483316f6a1a07bba615908 (patch)
tree5dd695890e40a7591fa2a769ee2871e4257a5170 /fs/ocfs2
parentcc6eb725955efb026007e1d7da8fe5383981afd2 (diff)
ocfs2: Handle the DLM_CANCELGRANT case in user_unlock_ast()
Remove the code which attempted to catch it via dlmunlock() return status - this never happens there. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/dlm/userdlm.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/fs/ocfs2/dlm/userdlm.c b/fs/ocfs2/dlm/userdlm.c
index d0f1027a3853..808ec0527c75 100644
--- a/fs/ocfs2/dlm/userdlm.c
+++ b/fs/ocfs2/dlm/userdlm.c
@@ -233,23 +233,38 @@ static void user_unlock_ast(void *opaque, enum dlm_status status)
233 233
234 mlog(0, "UNLOCK AST called on lock %s\n", lockres->l_name); 234 mlog(0, "UNLOCK AST called on lock %s\n", lockres->l_name);
235 235
236 if (status != DLM_NORMAL) 236 if (status != DLM_NORMAL && status != DLM_CANCELGRANT)
237 mlog(ML_ERROR, "Dlm returns status %d\n", status); 237 mlog(ML_ERROR, "Dlm returns status %d\n", status);
238 238
239 spin_lock(&lockres->l_lock); 239 spin_lock(&lockres->l_lock);
240 if (lockres->l_flags & USER_LOCK_IN_TEARDOWN) 240 if (lockres->l_flags & USER_LOCK_IN_TEARDOWN)
241 lockres->l_level = LKM_IVMODE; 241 lockres->l_level = LKM_IVMODE;
242 else { 242 else if (status == DLM_CANCELGRANT) {
243 mlog(0, "Lock %s, cancel fails, flags 0x%x\n",
244 lockres->l_name, lockres->l_flags);
245 /* We tried to cancel a convert request, but it was
246 * already granted. Don't clear the busy flag - the
247 * ast should've done this already. */
248 BUG_ON(!(lockres->l_flags & USER_LOCK_IN_CANCEL));
249 lockres->l_flags &= ~USER_LOCK_IN_CANCEL;
250 goto out_noclear;
251 } else {
252 BUG_ON(!(lockres->l_flags & USER_LOCK_IN_CANCEL));
253 /* Cancel succeeded, we want to re-queue */
254 mlog(0, "Lock %s, cancel succeeds, flags 0x%x\n",
255 lockres->l_name, lockres->l_flags);
243 lockres->l_requested = LKM_IVMODE; /* cancel an 256 lockres->l_requested = LKM_IVMODE; /* cancel an
244 * upconvert 257 * upconvert
245 * request. */ 258 * request. */
246 lockres->l_flags &= ~USER_LOCK_IN_CANCEL; 259 lockres->l_flags &= ~USER_LOCK_IN_CANCEL;
247 /* we want the unblock thread to look at it again 260 /* we want the unblock thread to look at it again
248 * now. */ 261 * now. */
249 __user_dlm_queue_lockres(lockres); 262 if (lockres->l_flags & USER_LOCK_BLOCKED)
263 __user_dlm_queue_lockres(lockres);
250 } 264 }
251 265
252 lockres->l_flags &= ~USER_LOCK_BUSY; 266 lockres->l_flags &= ~USER_LOCK_BUSY;
267out_noclear:
253 spin_unlock(&lockres->l_lock); 268 spin_unlock(&lockres->l_lock);
254 269
255 wake_up(&lockres->l_event); 270 wake_up(&lockres->l_event);
@@ -299,7 +314,9 @@ static void user_dlm_unblock_lock(void *opaque)
299 } 314 }
300 315
301 if (lockres->l_flags & USER_LOCK_BUSY) { 316 if (lockres->l_flags & USER_LOCK_BUSY) {
302 mlog(0, "BUSY flag detected...\n"); 317 mlog(0, "Cancel lock %s, flags 0x%x\n",
318 lockres->l_name, lockres->l_flags);
319
303 if (lockres->l_flags & USER_LOCK_IN_CANCEL) { 320 if (lockres->l_flags & USER_LOCK_IN_CANCEL) {
304 spin_unlock(&lockres->l_lock); 321 spin_unlock(&lockres->l_lock);
305 goto drop_ref; 322 goto drop_ref;
@@ -313,14 +330,7 @@ static void user_dlm_unblock_lock(void *opaque)
313 LKM_CANCEL, 330 LKM_CANCEL,
314 user_unlock_ast, 331 user_unlock_ast,
315 lockres); 332 lockres);
316 if (status == DLM_CANCELGRANT) { 333 if (status != DLM_NORMAL)
317 /* If we got this, then the ast was fired
318 * before we could cancel. We cleanup our
319 * state, and restart the function. */
320 spin_lock(&lockres->l_lock);
321 lockres->l_flags &= ~USER_LOCK_IN_CANCEL;
322 spin_unlock(&lockres->l_lock);
323 } else if (status != DLM_NORMAL)
324 user_log_dlm_error("dlmunlock", status, lockres); 334 user_log_dlm_error("dlmunlock", status, lockres);
325 goto drop_ref; 335 goto drop_ref;
326 } 336 }