Whamcloud - gitweb
LU-13437 mdt: don't fetch LOOKUP lock for remote object
[fs/lustre-release.git] / lustre / lmv / lmv_intent.c
index 9e31b5f..e4b184c 100644 (file)
@@ -152,6 +152,7 @@ out:
 }
 
 int lmv_revalidate_slaves(struct obd_export *exp,
 }
 
 int lmv_revalidate_slaves(struct obd_export *exp,
+                         const struct lu_fid *pfid,
                          const struct lmv_stripe_md *lsm,
                          ldlm_blocking_callback cb_blocking,
                          int extra_lock_flags)
                          const struct lmv_stripe_md *lsm,
                          ldlm_blocking_callback cb_blocking,
                          int extra_lock_flags)
@@ -198,7 +199,7 @@ int lmv_revalidate_slaves(struct obd_export *exp,
                 * which is not needed here.
                 */
                memset(op_data, 0, sizeof(*op_data));
                 * which is not needed here.
                 */
                memset(op_data, 0, sizeof(*op_data));
-               op_data->op_fid1 = fid;
+               op_data->op_fid1 = *pfid;
                op_data->op_fid2 = fid;
 
                tgt = lmv_tgt(lmv, lsm->lsm_md_oinfo[i].lmo_mds);
                op_data->op_fid2 = fid;
 
                tgt = lmv_tgt(lmv, lsm->lsm_md_oinfo[i].lmo_mds);
@@ -439,13 +440,18 @@ lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data,
        }
 
 retry:
        }
 
 retry:
-       tgt = lmv_locate_tgt(lmv, op_data);
+       if (op_data->op_name) {
+               tgt = lmv_locate_tgt(lmv, op_data);
+               if (!fid_is_sane(&op_data->op_fid2))
+                       fid_zero(&op_data->op_fid2);
+       } else if (fid_is_sane(&op_data->op_fid2)) {
+               tgt = lmv_fid2tgt(lmv, &op_data->op_fid2);
+       } else {
+               tgt = lmv_fid2tgt(lmv, &op_data->op_fid1);
+       }
        if (IS_ERR(tgt))
                RETURN(PTR_ERR(tgt));
 
        if (IS_ERR(tgt))
                RETURN(PTR_ERR(tgt));
 
-       if (!fid_is_sane(&op_data->op_fid2))
-               fid_zero(&op_data->op_fid2);
-
        CDEBUG(D_INODE, "LOOKUP_INTENT with fid1="DFID", fid2="DFID
               ", name='%s' -> mds #%u\n",
               PFID(&op_data->op_fid1), PFID(&op_data->op_fid2),
        CDEBUG(D_INODE, "LOOKUP_INTENT with fid1="DFID", fid2="DFID
               ", name='%s' -> mds #%u\n",
               PFID(&op_data->op_fid1), PFID(&op_data->op_fid2),
@@ -463,7 +469,8 @@ retry:
                /* If RPC happens, lsm information will be revalidated
                 * during update_inode process (see ll_update_lsm_md) */
                if (lmv_dir_striped(op_data->op_mea2)) {
                /* If RPC happens, lsm information will be revalidated
                 * during update_inode process (see ll_update_lsm_md) */
                if (lmv_dir_striped(op_data->op_mea2)) {
-                       rc = lmv_revalidate_slaves(exp, op_data->op_mea2,
+                       rc = lmv_revalidate_slaves(exp, &op_data->op_fid2,
+                                                  op_data->op_mea2,
                                                   cb_blocking,
                                                   extra_lock_flags);
                        if (rc != 0)
                                                   cb_blocking,
                                                   extra_lock_flags);
                        if (rc != 0)