diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 3ff888499c812f6561f90d41d1af9d419e54b9e2..e32a1032889544242a5785334a486c07eb07959f 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -120,7 +120,7 @@ noreproc: /* Go to sleep until the lock is granted or cancelled. */ rc = l_wait_event(lock->l_waitq, ((lock->l_req_mode == lock->l_granted_mode) || - lock->l_destroyed), &lwi); + (lock->l_flags & LDLM_FL_CANCEL)), &lwi); if (lock->l_destroyed) { LDLM_DEBUG(lock, "client-side enqueue waking up: destroyed"); diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index 0c0b51fc3efda5eba5a2ef2321f309e4e56d8ad8..7043171e5f861dc85cc2df5a9b518127a5e10b8d 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -283,6 +283,9 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q, lock = list_entry(tmp, struct ldlm_lock, l_res_link); LDLM_LOCK_GET(lock); + lock->l_flags |= LDLM_FL_CANCEL; + lock->l_flags |= flags; + if (local_only && (lock->l_readers || lock->l_writers)) { /* This is a little bit gross, but much better than the * alternative: pretend that we got a blocking AST from @@ -291,16 +294,13 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q, lock->l_flags |= LDLM_FL_CBPENDING; /* ... without sending a CANCEL message. */ lock->l_flags |= LDLM_FL_LOCAL_ONLY; - /* caller may also specify additional flags */ - lock->l_flags |= flags; LDLM_DEBUG(lock, "setting FL_LOCAL_ONLY"); + if (lock->l_completion_ast) + lock->l_completion_ast(lock, 0, NULL); LDLM_LOCK_PUT(lock); continue; } - - lock->l_flags |= flags; - if (client) { struct lustre_handle lockh; ldlm_lock2handle(lock, &lockh); @@ -377,7 +377,7 @@ int ldlm_namespace_free(struct ldlm_namespace *ns, int force) spin_unlock(&ldlm_namespace_lock); /* At shutdown time, don't call the cancellation callback */ - ldlm_namespace_cleanup(ns, LDLM_FL_CANCEL); + ldlm_namespace_cleanup(ns, 0); #ifdef __KERNEL__ { diff --git a/lustre/ptlrpc/recover.c b/lustre/ptlrpc/recover.c index ed969fe579b7a3f9db325e1a6881f67d63f5df56..9341403e8dad1521fd2bcdfdc0fc2cd52733d7d3 100644 --- a/lustre/ptlrpc/recover.c +++ b/lustre/ptlrpc/recover.c @@ -225,7 +225,7 @@ inline void ptlrpc_invalidate_import_state(struct obd_import *imp) obd_invalidate_import(obd, imp); #endif - ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY | LDLM_FL_CANCEL); + ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY); } void ptlrpc_handle_failed_import(struct obd_import *imp)