diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index ba98b1ae81532d44fe94bf504058bbcf36824b0d..325107544e8825ae3a7b8f114899b8b708ac6305 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 50bc96a61f4c501f91246947f3007d89d5de082b..016a471bccf1456b9d32c90f2a8f7bff6ff448fa 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);