From 8deea7888c0c242e549e6a567f9aa5d1c7c3558e Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Wed, 17 Oct 2018 05:57:30 +0800 Subject: [PATCH] LU-11508 mdt: reject DoM file migration Now that DoM file migration between MDTs is not suppoted, reject it to avoid data loss. Add sanity.sh 230j. Signed-off-by: Lai Siyao Signed-off-by: Peter Jones Change-Id: I029446918692f911c29d2409e1398e1b147737c3 Reviewed-on: https://review.whamcloud.com/33394 Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/mdt/mdt_reint.c | 14 ++++++++++++++ lustre/tests/sanity.sh | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index e6ac0a8..3642f60 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -2044,6 +2044,20 @@ static int mdt_reint_migrate_internal(struct mdt_thread_info *info) */ do_sync = rc; + /* TODO: DoM migration is not supported yet */ + if (S_ISREG(lu_object_attr(&sobj->mot_obj))) { + ma->ma_lmm = info->mti_big_lmm; + ma->ma_lmm_size = info->mti_big_lmmsize; + ma->ma_valid = 0; + rc = mdt_stripe_get(info, sobj, ma, XATTR_NAME_LOV); + if (rc) + GOTO(put_source, rc); + + if (ma->ma_valid & MA_LOV && + mdt_lmm_dom_entry(ma->ma_lmm) != LMM_NO_DOM) + GOTO(put_source, rc = -EOPNOTSUPP); + } + /* if migration HSM is allowed */ if (!mdt->mdt_opts.mo_migrate_hsm_allowed) { ma->ma_need = MA_HSM; diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 32e4639..42789ad 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -15419,6 +15419,23 @@ test_230i() { } run_test 230i "lfs migrate -m tolerates trailing slashes" +test_230j() { + [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" + [ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.52) ] && + skip "Need MDS version at least 2.11.52" + + $LFS mkdir -m 0 -c 1 $DIR/$tdir || error "mkdir $tdir failed" + $LFS setstripe -E 1M -L mdt $DIR/$tdir/$tfile || + error "create $tfile failed" + cat /etc/passwd > $DIR/$tdir/$tfile + + $LFS migrate -m 1 $DIR/$tdir + + cmp /etc/passwd $DIR/$tdir/$tfile || + error "DoM file mismatch after migration" +} +run_test 230j "DoM file data not changed after dir migration" + test_231a() { # For simplicity this test assumes that max_pages_per_rpc -- 1.8.3.1