From bc0b93d6026081681762bec06a231c614744d58b Mon Sep 17 00:00:00 2001 From: pschwan Date: Tue, 18 Jun 2002 03:38:03 +0000 Subject: [PATCH] Another attempted DLM deadlock fixup --- lustre/ldlm/ldlm_lock.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 66cc28b..815d3d0 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -160,7 +160,10 @@ static int ldlm_intent_policy(struct ldlm_lock *lock, void *req_cookie, CDEBUG(D_INFO, "remote intent: locking %d instead of" "%ld\n", mds_rep->ino, (long)old_res); - ldlm_resource_put(lock->l_resource); + spin_lock(&lock->l_resource->lr_lock); + if (!ldlm_resource_put(lock->l_resource)) + /* unlock it unless the resource was freed */ + spin_unlock(&lock->l_resource->lr_lock); lock->l_resource = ldlm_resource_get(ns, NULL, new_resid, type, 1); @@ -525,7 +528,9 @@ ldlm_error_t ldlm_local_lock_enqueue(struct lustre_handle *lockh, ldlm_resource_put(res); if (rc == ELDLM_LOCK_CHANGED) { + spin_unlock(&res->lr_lock); res = lock->l_resource; + spin_lock(&res->lr_lock); *flags |= LDLM_FL_LOCK_CHANGED; } else if (rc == ELDLM_LOCK_ABORTED) { /* Abort. */ -- 1.8.3.1