Whamcloud - gitweb
LU-14537 mdd: directory migrate skips project ID check 10/42110/3
authorLai Siyao <lai.siyao@whamcloud.com>
Sat, 13 Mar 2021 15:48:54 +0000 (23:48 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 5 May 2021 02:50:07 +0000 (02:50 +0000)
mdd_migrate_sanity_check() used to call mdd_rename_sanity_check(),
while the latter checks parent and sub file project ID, which is
redundant for migration because it's an internal layout change.

Add sanity 230t.

Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: If5ac2131acb1dfb30a312dc34052287776f581c7
Reviewed-on: https://review.whamcloud.com/42110
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdd/mdd_dir.c
lustre/tests/sanity.sh

index 2f69cc7..537bff8 100644 (file)
@@ -3330,8 +3330,12 @@ static int mdd_migrate_sanity_check(const struct lu_env *env,
        if (mdd_object_exists(tobj))
                RETURN(-EEXIST);
 
-       rc = mdd_rename_sanity_check(env, spobj, spattr, tpobj, tpattr, sobj,
-                                    attr, NULL, NULL);
+       rc = mdd_may_delete(env, spobj, spattr, sobj, attr, NULL, 1, 0);
+       if (rc)
+               RETURN(rc);
+
+       rc = mdd_may_create(env, tpobj, tpattr, NULL, true);
+
        RETURN(rc);
 }
 
index 75b3565..3b16190 100755 (executable)
@@ -19311,6 +19311,22 @@ test_230s() {
 }
 run_test 230s "lfs mkdir should return -EEXIST if target exists"
 
+test_230t()
+{
+       [[ $MDSCOUNT -ge 2 ]] || skip_env "needs >= 2 MDTs"
+       [[ $MDS1_VERSION -ge $(version_code 2.14.50) ]] ||
+               skip "Need MDS version at least 2.14.50"
+
+       test_mkdir $DIR/$tdir || error "mkdir $tdir failed"
+       test_mkdir $DIR/$tdir/subdir || error "mkdir subdir failed"
+       $LFS project -p 1 -s $DIR/$tdir ||
+               error "set $tdir project id failed"
+       $LFS project -p 2 -s $DIR/$tdir/subdir ||
+               error "set subdir project id failed"
+       $LFS migrate -m 1 -c $MDSCOUNT $DIR/$tdir || error "migrate failed"
+}
+run_test 230t "migrate directory with project ID set"
+
 test_231a()
 {
        # For simplicity this test assumes that max_pages_per_rpc