From 64eb02ffed4afe067eb090b5cb06a91f0d6fd1a9 Mon Sep 17 00:00:00 2001 From: Andriy Skulysh Date: Mon, 4 Jan 2016 10:17:07 +0200 Subject: [PATCH] LU-7626 ldlm: refcount nonzero (1) after lock cleanup 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 Reviewed-on: http://es-gerrit.xyus.xyratex.com:8080/9406 Tested-by: Jenkins Reviewed-by: Mirza Arshad Mirza Hussain Reviewed-by: Alexey Leonidovich Lyashkov Tested-by: Parinay Vijayprakash Kondekar Reviewed-on: http://review.whamcloud.com/17791 Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/ldlm/ldlm_lock.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 183cfac..e973edc 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -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; -- 1.8.3.1