From: John L. Hammond Date: Thu, 24 Jul 2014 17:56:20 +0000 (-0500) Subject: LU-5370 mdt: return -MDT_EREMOTE_OPEN for remote open X-Git-Tag: 2.6.51~30 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=c0b065010beb8a5b8142b81504e62a433492ec46;ds=sidebyside LU-5370 mdt: return -MDT_EREMOTE_OPEN for remote open 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 Change-Id: I7a498adc341c2b52b29c94f65e66431c5de06917 Reviewed-on: http://review.whamcloud.com/11218 Tested-by: Jenkins Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: wangdi Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 2e4e8c0..413c4ae 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -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); diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 9017957d..75127e3 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -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; diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index b9022e4..d179df9 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -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