Whamcloud - gitweb
LU-16135 lod: prohibit DoM pattern in plain layout
authorMikhail Pershin <mpershin@whamcloud.com>
Mon, 5 Sep 2022 07:41:37 +0000 (10:41 +0300)
committerAndreas Dilger <adilger@whamcloud.com>
Tue, 11 Oct 2022 07:51:16 +0000 (07:51 +0000)
DoM pattern can be set as default directory plain layout by
older LFS version. It misses DoM component sanity checks if
plain layout is used. Such layout is not allowed and causes
later crashed when file is created under that directory.

While LFS can prevent this but not in all Lustre versions,
so LOD should do the check as well

Lustre-change: https://review.whamcloud.com/48433
Lustre-commit: a8272168e3888ec4ced18035182159a8ee56a51a

Signed-off-by: Mikhail Pershin <mpershin@whamcloud.com>
Change-Id: Ic58fdda2ab3e63083128cb6cf949fcb43ccd2c02
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/48514
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/lod/lod_lov.c
lustre/tests/sanity.sh

index 6d4b08d..329688e 100644 (file)
@@ -2103,6 +2103,12 @@ int lod_verify_striping(const struct lu_env *env, struct lod_device *d,
        case LOV_USER_MAGIC_V1:
        case LOV_USER_MAGIC_V3:
        case LOV_USER_MAGIC_SPECIFIC:
+               if (lov_pattern(le32_to_cpu(lum->lmm_pattern)) ==
+                   LOV_PATTERN_MDT) {
+                       /* DoM must use composite layout */
+                       CDEBUG(D_LAYOUT, "DoM without composite layout\n");
+                       RETURN(-EINVAL);
+               }
                RETURN(lod_verify_v1v3(d, buf, is_from_disk));
        case LOV_USER_MAGIC_COMP_V1:
        case LOV_USER_MAGIC_SEL:
index 54880c6..f58b630 100755 (executable)
@@ -22041,12 +22041,20 @@ test_270h() {
 run_test 270h "DoM: DoM stripe removal when disabled on server"
 
 test_270i() {
-       (( $MDS1_VERSION >= $(version_code 2.14.54) )) ||
-               skip "Need MDS version at least 2.14.54"
+       (( $MDS1_VERSION >= $(version_code 2.14.0.62) )) ||
+               skip "Need MDS version at least 2.14.0.62"
 
        mkdir $DIR/$tdir
+       # DoM with plain layout
        $LFS setstripe -L mdt -S 128k -c -1 $DIR/$tdir &&
-               error "setstripe should fail" || true
+               error "default plain layout with DoM must fail"
+       $LFS setstripe -L mdt -S 128k -c -1 $DIR/$tdir/$tfile &&
+               error "setstripe plain file layout with DoM must fail"
+       $LFS setstripe -E 1M -L mdt -S 128k -c -1 -E eof $DIR/$tdir &&
+               error "default DoM layout with bad striping must fail"
+       $LFS setstripe -E 1M -L mdt -S 128k -c -1 -E eof $DIR/$tdir/$tfile &&
+               error "setstripe to DoM layout with bad striping must fail"
+       return 0
 }
 run_test 270i "DoM: setting invalid DoM striping should fail"