Whamcloud - gitweb
LU-7091 mdt: release cross-MDT lock immediately 72/16372/8
authorwang di <di.wang@intel.com>
Wed, 9 Sep 2015 17:51:39 +0000 (10:51 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 2 Oct 2015 19:15:39 +0000 (19:15 +0000)
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 <di.wang@intel.com>
Change-Id: I48be60a13e9d10a92595c7faeb91dd8c106b2d42
Reviewed-on: http://review.whamcloud.com/16372
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osp/osp_md_object.c

index 1df63f3..4aada8f 100644 (file)
@@ -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;
 }