Whamcloud - gitweb
LU-5431 lmv: release locks if lmv_intent_lock() fails 19/11319/2
authorJohn L. Hammond <john.hammond@intel.com>
Mon, 4 Aug 2014 21:05:37 +0000 (16:05 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 11 Aug 2014 05:40:08 +0000 (05:40 +0000)
In lmv_intent_lock() if we will return an error then first release any
locks referenced by the intent.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I43fa0d3869cf365175750b0cf944145c13f31006
Reviewed-on: http://review.whamcloud.com/11319
Tested-by: Jenkins
Reviewed-by: wangdi <di.wang@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lmv/lmv_intent.c

index 212a8b2..096f83a 100644 (file)
@@ -537,5 +537,27 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
        else
                LBUG();
 
        else
                LBUG();
 
+       if (rc < 0) {
+               struct lustre_handle lock_handle;
+
+               if (it->d.lustre.it_lock_mode != 0) {
+                       lock_handle.cookie = it->d.lustre.it_lock_handle;
+                       ldlm_lock_decref(&lock_handle,
+                                        it->d.lustre.it_lock_mode);
+               }
+
+               it->d.lustre.it_lock_handle = 0;
+               it->d.lustre.it_lock_mode = 0;
+
+               if (it->d.lustre.it_remote_lock_mode != 0) {
+                       lock_handle.cookie = it->d.lustre.it_remote_lock_handle;
+                       ldlm_lock_decref(&lock_handle,
+                                        it->d.lustre.it_remote_lock_mode);
+               }
+
+               it->d.lustre.it_remote_lock_handle = 0;
+               it->d.lustre.it_remote_lock_mode = 0;
+       }
+
        RETURN(rc);
 }
        RETURN(rc);
 }