From bb5c8e257d0d1ed111da68715c0a3a49849b4fdf Mon Sep 17 00:00:00 2001 From: rread Date: Mon, 5 Jan 2004 18:57:17 +0000 Subject: [PATCH] b=2460 r=phil Make sure threads waiting for a completion callback are awoken when the client is evicted. Also set LDLM_FL_CANCEL explicitely in cleanup_resouces, so callers of ldmm_namespace_cleanup no longer need to specify it. --- lustre/ldlm/ldlm_request.c | 2 +- lustre/ldlm/ldlm_resource.c | 12 ++++++------ lustre/ptlrpc/recover.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 3ff8884..e32a103 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 0c0b51f..7043171 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 ed969fe..9341403 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) -- 1.8.3.1