Whamcloud - gitweb
LU-7626 ldlm: refcount nonzero (1) after lock cleanup 91/17791/3
authorAndriy Skulysh <andriy.skulysh@seagate.com>
Mon, 4 Jan 2016 08:17:07 +0000 (10:17 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 14 Jun 2016 03:50:34 +0000 (03:50 +0000)
It is a regression after LU-2177.
LCK_NL is used by obdecho also.

Perform flock sanity checks only for LDLM_FLOCK.

Change-Id: I83f87b41a13c4d666af36af389ccf1a127197294
Xyratex-bug-id: MRP-2336
Signed-off-by: Andriy Skulysh <andriy.skulysh@seagate.com>
Reviewed-on: http://es-gerrit.xyus.xyratex.com:8080/9406
Tested-by: Jenkins
Reviewed-by: Mirza Arshad Mirza Hussain <arshad.hussain@seagate.com>
Reviewed-by: Alexey Leonidovich Lyashkov <alexey.lyashkov@seagate.com>
Tested-by: Parinay Vijayprakash Kondekar <parinay.kondekar@seagate.com>
Reviewed-on: http://review.whamcloud.com/17791
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ldlm/ldlm_lock.c

index 183cfac..e973edc 100644 (file)
@@ -1110,23 +1110,26 @@ void ldlm_grant_lock(struct ldlm_lock *lock, struct list_head *work_list)
        if (work_list && lock->l_completion_ast != NULL)
                ldlm_add_ast_work_item(lock, NULL, work_list);
 
-       /* We should not add locks to granted list in the following cases:
-        * - this is an UNLOCK but not a real lock;
-        * - this is a TEST lock;
-        * - this is a F_CANCELLK lock (async flock has req_mode == 0)
-        * - this is a deadlock (flock cannot be granted) */
-       if (lock->l_req_mode == 0 ||
-           lock->l_req_mode == LCK_NL ||
-           ldlm_is_test_lock(lock) ||
-           ldlm_is_flock_deadlock(lock))
-               RETURN_EXIT;
-
         if (res->lr_type == LDLM_PLAIN || res->lr_type == LDLM_IBITS)
                 ldlm_grant_lock_with_skiplist(lock);
         else if (res->lr_type == LDLM_EXTENT)
                 ldlm_extent_add_lock(res, lock);
-        else
-                ldlm_resource_add_lock(res, &res->lr_granted, lock);
+       else if (res->lr_type == LDLM_FLOCK) {
+               /* We should not add locks to granted list in the following
+                * cases:
+                * - this is an UNLOCK but not a real lock;
+                * - this is a TEST lock;
+                * - this is a F_CANCELLK lock (async flock has req_mode == 0)
+                * - this is a deadlock (flock cannot be granted) */
+               if (lock->l_req_mode == 0 ||
+                   lock->l_req_mode == LCK_NL ||
+                   ldlm_is_test_lock(lock) ||
+                   ldlm_is_flock_deadlock(lock))
+                       RETURN_EXIT;
+               ldlm_resource_add_lock(res, &res->lr_granted, lock);
+       } else {
+               LBUG();
+       }
 
         ldlm_pool_add(&ldlm_res_to_ns(res)->ns_pool, lock);
         EXIT;