Whamcloud - gitweb
LU-5367 mdt: handle failed PDO lock in mdt_object_local_lock() 19/11219/3
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 24 Jul 2014 18:03:02 +0000 (13:03 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 11 Aug 2014 05:38:43 +0000 (05:38 +0000)
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 <john.hammond@intel.com>
Change-Id: I17a01d569a77a86f8ce72a1617f0cb8ed500985b
Reviewed-on: http://review.whamcloud.com/11219
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_handler.c

index 413c4ae..24339a9 100644 (file)
@@ -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