From: John L. Hammond Date: Sun, 18 Sep 2016 20:37:13 +0000 (-0400) Subject: staging: lustre: lmv: release locks if lmv_intent_lock() fails X-Git-Tag: v4.9.8~1233^2~489 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=620f086d9ae2e4b47c67ac05b76153dfc30d0b1f;p=platform%2Fkernel%2Flinux-rpi3.git staging: lustre: 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 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5431 Reviewed-on: http://review.whamcloud.com/11319 Reviewed-by: wang di Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/lmv/lmv_intent.c b/drivers/staging/lustre/lustre/lmv/lmv_intent.c index 85cc5cb..fd3dc7c 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_intent.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_intent.c @@ -533,5 +533,27 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data, extra_lock_flags); else LBUG(); + + if (rc < 0) { + struct lustre_handle lock_handle; + + if (it->it_lock_mode) { + lock_handle.cookie = it->it_lock_handle; + ldlm_lock_decref(&lock_handle, it->it_lock_mode); + } + + it->it_lock_handle = 0; + it->it_lock_mode = 0; + + if (it->it_remote_lock_mode) { + lock_handle.cookie = it->it_remote_lock_handle; + ldlm_lock_decref(&lock_handle, + it->it_remote_lock_mode); + } + + it->it_remote_lock_handle = 0; + it->it_remote_lock_mode = 0; + } + return rc; }