From: John L. Hammond Date: Mon, 4 Aug 2014 21:05:37 +0000 (-0500) Subject: LU-5431 lmv: release locks if lmv_intent_lock() fails X-Git-Tag: 2.6.51~21 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=f2e4d30a95f4fdb55d18da097c24d441e564c579 LU-5431 lmv: release locks if lmv_intent_lock() fails 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 Change-Id: I43fa0d3869cf365175750b0cf944145c13f31006 Reviewed-on: http://review.whamcloud.com/11319 Tested-by: Jenkins Reviewed-by: wangdi Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 212a8b2..096f83a 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -537,5 +537,27 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data, 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); }