Whamcloud - gitweb
LU-5370 mdt: return -MDT_EREMOTE_OPEN for remote open 18/11218/3
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 24 Jul 2014 17:56:20 +0000 (12:56 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 11 Aug 2014 05:36:27 +0000 (05:36 +0000)
Add a special magical errno MDT_EREMOTE_OPEN for communicaiton between
mdt_reint_open() and mdt_intent_reint() which means return the lock to
the client for subsequent cross ref open. Previously we used plain
-EREMOTE but other functions called in that path might return it too
and confuse us. This is not returned to the client.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I7a498adc341c2b52b29c94f65e66431c5de06917
Reviewed-on: http://review.whamcloud.com/11218
Tested-by: Jenkins
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_open.c

index 2e4e8c0..413c4ae 100644 (file)
@@ -3348,7 +3348,7 @@ static int mdt_intent_reint(enum mdt_it_code opcode,
 
        /* the open lock or the lock for cross-ref object should be
         * returned to the client */
-       if (rc == -EREMOTE || mdt_get_disposition(rep, DISP_OPEN_LOCK)) {
+       if (rc == -MDT_EREMOTE_OPEN || mdt_get_disposition(rep, DISP_OPEN_LOCK)) {
                LASSERT(lustre_handle_is_used(&lhc->mlh_reg_lh));
                rep->lock_policy_res2 = 0;
                rc = mdt_intent_lock_replace(info, lockp, lhc, flags);
index 9017957..75127e3 100644 (file)
@@ -307,6 +307,13 @@ enum {
         MDT_CROSS_LOCK
 };
 
+/* Special magical errno for communicaiton between mdt_reint_open()
+ * and mdt_intent_reint() which means return the lock to the client
+ * for subsequent cross ref open. Previously we used plain -EREMOTE
+ * but other functions called in that path might return it too and
+ * confuse us. This is not returned to the client. See LU-5370. */
+#define MDT_EREMOTE_OPEN (EREMOTE + 1024)
+
 struct mdt_reint_record {
        mdt_reint_t                      rr_opcode;
        const struct lustre_handle      *rr_handle;
index b9022e4..d179df9 100644 (file)
@@ -1392,7 +1392,7 @@ static void mdt_object_open_unlock(struct mdt_thread_info *info,
                up_read(&obj->mot_open_sem);
 
        /* Cross-ref case, the lock should be returned to the client */
-       if (ibits == 0 || rc == -EREMOTE)
+       if (ibits == 0 || rc == -MDT_EREMOTE_OPEN)
                RETURN_EXIT;
 
        if (!(open_flags & MDS_OPEN_LOCK) && !(ibits & MDS_INODELOCK_LAYOUT)) {
@@ -1817,7 +1817,7 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc)
                         if (rc != 0)
                                 result = rc;
                        else
-                               result = -EREMOTE;
+                               result = -MDT_EREMOTE_OPEN;
                         GOTO(out_child, result);
                } else if (mdt_object_exists(child)) {
                        /* We have to get attr & LOV EA & HSM for this