From f1192f18ed6381f82f84bba3873268af39cad73d Mon Sep 17 00:00:00 2001
From: bobijam <bobijam>
Date: Tue, 29 Jul 2008 02:18:52 +0000
Subject: [PATCH] Branch HEAD b=15924 i=johann, green

should check ldlm_lock::l_destroyed with ldlm_resource::lr_lock locked.
---
 lustre/ldlm/ldlm_flock.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lustre/ldlm/ldlm_flock.c b/lustre/ldlm/ldlm_flock.c
index 737de8235d..2771a53cc4 100644
--- a/lustre/ldlm/ldlm_flock.c
+++ b/lustre/ldlm/ldlm_flock.c
@@ -547,18 +547,19 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, int flags, void *data)
         RETURN(rc);
 
 granted:
+        LDLM_DEBUG(lock, "client-side enqueue granted");
+        ns = lock->l_resource->lr_namespace;
+        lock_res(lock->l_resource);
+
         /* before flock's complete ast gets here, the flock
          * can possibly be freed by another thread
          */
         if (lock->l_destroyed) {
                 LDLM_DEBUG(lock, "already destroyed by another thread");
+                unlock_res(lock->l_resource);
                 RETURN(0);
         }
 
-        LDLM_DEBUG(lock, "client-side enqueue granted");
-        ns = lock->l_resource->lr_namespace;
-        lock_res(lock->l_resource);
-
         /* take lock off the deadlock detection waitq. */
         spin_lock(&ldlm_flock_waitq_lock);
         list_del_init(&lock->l_flock_waitq);
-- 
GitLab