From d4400137d69bbf316cff5af08d60dc87f89e5900 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Thu, 24 Jul 2014 13:03:02 -0500 Subject: [PATCH] LU-5367 mdt: handle failed PDO lock in mdt_object_local_lock() In mdt_object_local_lock() call mdt_object_unlock() if mdt_fid_lock() fails on the PDO lock. This is needed because ldlm_cli_enqueue_local() may initialize the passed in lock handle and then fail later. Signed-off-by: John L. Hammond Change-Id: I17a01d569a77a86f8ce72a1617f0cb8ed500985b Reviewed-on: http://review.whamcloud.com/11219 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: wangdi Reviewed-by: Fan Yong Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin --- lustre/mdt/mdt_handler.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 413c4ae..24339a9 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -2438,8 +2438,8 @@ static int mdt_object_local_lock(struct mdt_thread_info *info, policy, res_id, dlmflags, info->mti_exp == NULL ? NULL : &info->mti_exp->exp_handle.h_cookie); - if (unlikely(rc)) - RETURN(rc); + if (unlikely(rc != 0)) + GOTO(out_unlock, rc); } /* @@ -2460,15 +2460,15 @@ static int mdt_object_local_lock(struct mdt_thread_info *info, res_id, LDLM_FL_LOCAL_ONLY | dlmflags, info->mti_exp == NULL ? NULL : &info->mti_exp->exp_handle.h_cookie); - if (rc) - mdt_object_unlock(info, o, lh, 1); - else if (unlikely(OBD_FAIL_PRECHECK(OBD_FAIL_MDS_PDO_LOCK)) && - lh->mlh_pdo_hash != 0 && - (lh->mlh_reg_mode == LCK_PW || lh->mlh_reg_mode == LCK_EX)) { - OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_PDO_LOCK, 15); - } +out_unlock: + if (rc != 0) + mdt_object_unlock(info, o, lh, 1); + else if (unlikely(OBD_FAIL_PRECHECK(OBD_FAIL_MDS_PDO_LOCK)) && + lh->mlh_pdo_hash != 0 && + (lh->mlh_reg_mode == LCK_PW || lh->mlh_reg_mode == LCK_EX)) + OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_PDO_LOCK, 15); - RETURN(rc); + RETURN(rc); } static int -- 1.8.3.1