- } else if (it_disposition(it, DISP_LOOKUP_NEG) &&
- lsm != NULL && lsm->lsm_md_magic == LMV_MAGIC_MIGRATE) {
- /* For migrating directory, if it can not find the child in
- * the source directory(master stripe), try the targeting
- * directory(stripe 1) */
- tgt = lmv_find_target(lmv, &lsm->lsm_md_oinfo[1].lmo_fid);
- if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
-
- ptlrpc_req_finished(*reqp);
- it->d.lustre.it_data = NULL;
- *reqp = NULL;
-
- CDEBUG(D_INODE, "For migrating dir, try target dir "DFID"\n",
- PFID(&lsm->lsm_md_oinfo[1].lmo_fid));
+ } else if (it_disposition(it, DISP_LOOKUP_NEG) && lsm != NULL &&
+ lmv_need_try_all_stripes(lsm)) {
+ /* For migrating and unknown hash type directory, it will
+ * try to target the entry on other stripes */
+ int stripe_index;
+
+ for (stripe_index = 1;
+ stripe_index < lsm->lsm_md_stripe_count &&
+ it_disposition(it, DISP_LOOKUP_NEG); stripe_index++) {
+ struct lmv_oinfo *oinfo;
+
+ /* release the previous request */
+ ptlrpc_req_finished(*reqp);
+ it->d.lustre.it_data = NULL;
+ *reqp = NULL;
+
+ oinfo = &lsm->lsm_md_oinfo[stripe_index];
+ tgt = lmv_find_target(lmv, &oinfo->lmo_fid);
+ if (IS_ERR(tgt))
+ RETURN(PTR_ERR(tgt));
+
+ CDEBUG(D_INODE, "Try other stripes " DFID"\n",
+ PFID(&oinfo->lmo_fid));