From f2e4d30a95f4fdb55d18da097c24d441e564c579 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Mon, 4 Aug 2014 16:05:37 -0500 Subject: [PATCH] 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 --- lustre/lmv/lmv_intent.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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); } -- 1.8.3.1