diff options
author | wang di <di.wang@intel.com> | 2016-09-18 23:38:57 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-09-19 11:08:22 +0300 |
commit | a1194ad691043fa5632f756c80a6bbafdb0f4dcd (patch) | |
tree | 113404a4ddebb9e2fb572cbc19426e6a301de273 /drivers/staging/lustre | |
parent | 8ed62e91c4adf3f37c665d1d892aa17dc7150ab7 (diff) | |
download | linux-a1194ad691043fa5632f756c80a6bbafdb0f4dcd.tar.xz |
staging: lustre: lmv: fix parent FID for migration
If the migrating directory is under striped directory, it needs
to set right stripe FID for its parent.
Signed-off-by: wang di <di.wang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6263
Reviewed-on: http://review.whamcloud.com/13817
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre')
-rw-r--r-- | drivers/staging/lustre/lustre/lmv/lmv_obd.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index a0792d481783..dad572eb76ec 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -1579,6 +1579,8 @@ lmv_locate_target_for_name(struct lmv_obd *lmv, struct lmv_stripe_md *lsm, struct lmv_tgt_desc *tgt; if (OBD_FAIL_CHECK(OBD_FAIL_LFSCK_BAD_NAME_HASH)) { + if (cfs_fail_val >= lsm->lsm_md_stripe_count) + return ERR_PTR(-EBADF); oinfo = &lsm->lsm_md_oinfo[cfs_fail_val]; } else { oinfo = lsm_name_to_stripe_info(lsm, name, namelen); @@ -1586,11 +1588,15 @@ lmv_locate_target_for_name(struct lmv_obd *lmv, struct lmv_stripe_md *lsm, return ERR_CAST(oinfo); } - *fid = oinfo->lmo_fid; - *mds = oinfo->lmo_mds; - tgt = lmv_get_target(lmv, *mds, NULL); + if (fid) + *fid = oinfo->lmo_fid; + if (mds) + *mds = oinfo->lmo_mds; + + tgt = lmv_get_target(lmv, oinfo->lmo_mds, NULL); - CDEBUG(D_INFO, "locate on mds %u "DFID"\n", *mds, PFID(fid)); + CDEBUG(D_INFO, "locate on mds %u " DFID "\n", oinfo->lmo_mds, + PFID(&oinfo->lmo_fid)); return tgt; } @@ -1953,10 +1959,24 @@ static int lmv_rename(struct obd_export *exp, struct md_op_data *op_data, if (op_data->op_cli_flags & CLI_MIGRATE) { LASSERTF(fid_is_sane(&op_data->op_fid3), "invalid FID "DFID"\n", PFID(&op_data->op_fid3)); + + if (op_data->op_mea1) { + struct lmv_stripe_md *lsm = op_data->op_mea1; + struct lmv_tgt_desc *tmp; + + /* Fix the parent fid for striped dir */ + tmp = lmv_locate_target_for_name(lmv, lsm, old, + oldlen, + &op_data->op_fid1, + NULL); + if (IS_ERR(tmp)) + return PTR_ERR(tmp); + } + rc = lmv_fid_alloc(NULL, exp, &op_data->op_fid2, op_data); if (rc) return rc; - src_tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid3); + src_tgt = lmv_find_target(lmv, &op_data->op_fid3); } else { if (op_data->op_mea1) { struct lmv_stripe_md *lsm = op_data->op_mea1; |