From 1f67e932c63f5ff54a8a7e05e2969f62c4aee059 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 8 Aug 2003 05:56:59 +0000 Subject: [PATCH 1/1] Land fix for bug 1558 on HEAD. r=phil,shaver --- lustre/ldlm/ldlm_lock.c | 4 ++++ lustre/ldlm/ldlm_lockd.c | 6 +----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index ba98b1a..3251075 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -153,6 +153,8 @@ void ldlm_lock_put(struct ldlm_lock *lock) ldlm_resource_putref(lock->l_resource); lock->l_resource = NULL; + if (lock->l_export) + class_export_put(lock->l_export); if (lock->l_parent) LDLM_LOCK_PUT(lock->l_parent); @@ -220,6 +222,8 @@ void ldlm_lock_destroy(struct ldlm_lock *lock) /* Wake anyone waiting for this lock */ /* FIXME: I should probably add yet another flag, instead of using * l_export to only call this on clients */ + if (lock->l_export) + class_export_put(lock->l_export); lock->l_export = NULL; if (lock->l_export && lock->l_completion_ast) lock->l_completion_ast(lock, 0); diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 50bc96a..016a471 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -179,8 +179,6 @@ static int ldlm_add_waiting_lock(struct ldlm_lock *lock) } list_add_tail(&lock->l_pending_chain, &waiting_locks_list); /* FIFO */ spin_unlock_bh(&waiting_locks_spinlock); - /* We drop this ref when we get removed from the list. */ - class_export_get(lock->l_export); return 1; } @@ -223,8 +221,6 @@ int ldlm_del_waiting_lock(struct ldlm_lock *lock) } list_del_init(&lock->l_pending_chain); spin_unlock_bh(&waiting_locks_spinlock); - /* We got this ref when we were added to the list. */ - class_export_put(lock->l_export); LDLM_DEBUG(lock, "removed"); return 1; } @@ -468,7 +464,7 @@ int ldlm_handle_enqueue(struct ptlrpc_request *req, LDLM_DEBUG(lock, "server-side enqueue handler, new lock created"); LASSERT(req->rq_export); - lock->l_export = req->rq_export; + lock->l_export = class_export_get(req->rq_export); l_lock(&lock->l_resource->lr_namespace->ns_lock); list_add(&lock->l_export_chain, &lock->l_export->exp_ldlm_data.led_held_locks); -- 1.8.3.1