Whamcloud - gitweb
LU-11642 lmv: allocate fid on parent MDT in migrate
[fs/lustre-release.git] / lustre / lmv / lmv_obd.c
index f2db29f..329965e 100644 (file)
@@ -1937,8 +1937,6 @@ static int lmv_migrate(struct obd_export *exp, struct md_op_data *op_data,
        ENTRY;
 
        LASSERT(op_data->op_cli_flags & CLI_MIGRATE);
-       LASSERTF(fid_is_sane(&op_data->op_fid3), "invalid FID "DFID"\n",
-                PFID(&op_data->op_fid3));
 
        CDEBUG(D_INODE, "MIGRATE "DFID"/%.*s\n",
               PFID(&op_data->op_fid1), (int)namelen, name);
@@ -2008,7 +2006,10 @@ static int lmv_migrate(struct obd_export *exp, struct md_op_data *op_data,
        if (IS_ERR(child_tgt))
                RETURN(PTR_ERR(child_tgt));
 
-       rc = lmv_fid_alloc(NULL, exp, &target_fid, op_data);
+       if (!S_ISDIR(op_data->op_mode) && tp_tgt)
+               rc = __lmv_fid_alloc(lmv, &target_fid, tp_tgt->ltd_idx);
+       else
+               rc = lmv_fid_alloc(NULL, exp, &target_fid, op_data);
        if (rc)
                RETURN(rc);