Whamcloud - gitweb
LU-11508 mdt: reject DoM file migration 94/33394/7
authorLai Siyao <lai.siyao@intel.com>
Tue, 16 Oct 2018 21:57:30 +0000 (05:57 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 10 Nov 2018 05:22:28 +0000 (05:22 +0000)
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 <lai.siyao@whamcloud.com>
Signed-off-by: Peter Jones <pjones@whamcloud.com>
Change-Id: I029446918692f911c29d2409e1398e1b147737c3
Reviewed-on: https://review.whamcloud.com/33394
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdt/mdt_reint.c
lustre/tests/sanity.sh

index e6ac0a8..3642f60 100644 (file)
@@ -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;
index 32e4639..42789ad 100755 (executable)
@@ -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