From d146596a15008ea137045a58da24263a28f327b9 Mon Sep 17 00:00:00 2001 From: wang di Date: Wed, 9 Sep 2015 10:51:39 -0700 Subject: [PATCH] LU-7091 mdt: release cross-MDT lock immediately Because the cross-MDT operations are relatively rare compared with the normal operation, so let's release cross-MDT lock immediately after the operation. Signed-off-by: wang di Change-Id: I48be60a13e9d10a92595c7faeb91dd8c106b2d42 Reviewed-on: http://review.whamcloud.com/16372 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin --- lustre/osp/osp_md_object.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lustre/osp/osp_md_object.c b/lustre/osp/osp_md_object.c index 1df63f3..4aada8f 100644 --- a/lustre/osp/osp_md_object.c +++ b/lustre/osp/osp_md_object.c @@ -863,7 +863,9 @@ static int osp_md_index_try(const struct lu_env *env, * Implementation of dt_object_operations::do_object_lock * * Enqueue a lock (by ldlm_cli_enqueue()) of remote object on the remote MDT, - * which will lock the object in the global namespace. + * which will lock the object in the global namespace. And because the + * cross-MDT locks are relatively rare compared with normal local MDT operation, + * let's release it right away, instead of putting it into the LRU list. * * \param[in] env execution environment * \param[in] dt object to be locked @@ -910,6 +912,13 @@ static int osp_md_object_lock(const struct lu_env *env, &flags, NULL, 0, LVB_T_NONE, lh, 0); ptlrpc_req_finished(req); + if (rc == ELDLM_OK) { + struct ldlm_lock *lock; + + lock = __ldlm_handle2lock(lh, 0); + ldlm_set_cbpending(lock); + LDLM_LOCK_PUT(lock); + } return rc == ELDLM_OK ? 0 : -EIO; } -- 1.8.3.1