Whamcloud - gitweb
LU-17088 dom: don't create different size DOM component 69/52269/2
authorBobi Jam <bobijam@whamcloud.com>
Tue, 5 Sep 2023 06:54:44 +0000 (14:54 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 23 Sep 2023 06:01:48 +0000 (06:01 +0000)
Multiple DOM components are allowed in diffrent mirror but they
must be of the same size, mirror extend should check this restraint.

Fix another glitch in lov_init_composite() where dom_size is used
as a __u64 value but declared as boolean.

Fixes: 44a721b8c1 ("LU-11421 dom: manual OST-to-DOM migration via mirroring")
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Ia0d08c697dbeeb3aa8d20d9849226afa06360012
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52269
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mikhail Pershin <mpershin@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lod/lod_lov.c
lustre/lov/lov_object.c
lustre/tests/sanity-flr.sh

index 81324ef..b8f1b74 100644 (file)
@@ -1188,6 +1188,7 @@ int lod_parse_striping(const struct lu_env *env, struct lod_object *lo,
        __u32 magic, pattern;
        __u16 mirror_cnt = 0;
        __u16 comp_cnt;
+       __u64 dom_size = 0;
        int i, rc;
        __u16 mirror_id = MIRROR_ID_NEG;
        bool stale = false;
@@ -1334,6 +1335,22 @@ int lod_parse_striping(const struct lu_env *env, struct lod_object *lo,
                if (!lov_pattern_supported(lov_pattern(pattern)))
                        GOTO(out, rc = -EINVAL);
 
+               if (pattern & LOV_PATTERN_MDT) {
+                       if (lod_comp->llc_extent.e_start != 0) {
+                               CERROR("%s: DOM entry must be the first stripe "
+                                      "in a mirror\n", lod2obd(d)->obd_name);
+                               GOTO(out, rc = -EINVAL);
+                       }
+                       if (!dom_size) {
+                               dom_size = lod_comp->llc_extent.e_end;
+                       } else if (dom_size != lod_comp->llc_extent.e_end) {
+                               CERROR("%s: DOM entries with different sizes "
+                                      "%#llx/%#llx\n", lod2obd(d)->obd_name,
+                                      dom_size, lod_comp->llc_extent.e_end);
+                               GOTO(out, rc = -EINVAL);
+                       }
+               }
+
                lod_comp->llc_pattern = pattern;
                lod_comp->llc_stripe_size = le32_to_cpu(lmm->lmm_stripe_size);
                lod_comp->llc_stripe_count = le16_to_cpu(lmm->lmm_stripe_count);
index 0cbbd1b..40d2cb6 100644 (file)
@@ -615,7 +615,7 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev,
        int result = 0;
        unsigned int seq;
        int i, j, preference;
-       bool dom_size = 0;
+       __u64 dom_size = 0;
 
        ENTRY;
 
index cb5d889..c19cb9a 100644 (file)
@@ -967,7 +967,7 @@ test_5() {
 }
 run_test 5 "Make sure init size work for mirrored layout"
 
-test_6() {
+test_6a() {
        (( $MDS1_VERSION >= $(version_code 2.12.58) )) ||
                skip "MDS version older than 2.12.58"
 
@@ -991,7 +991,22 @@ test_6() {
        $LFS mirror extend -N -f $tf-1 $tf-2 ||
                error "failure to extend mirrored file with DoM extent"
 }
-run_test 6 "DoM and FLR work together"
+run_test 6a "DoM and FLR work together"
+
+test_6b() {
+       (( $MDS1_VERSION >= $(version_code 2.15.58.1) )) ||
+               skip "MDS version older than 2.15.58.1"
+
+       local tf=$DIR/$tfile
+
+       $LFS setstripe -E64K -L mdt -Eeof $tf ||
+               error "failure to create PFL with DoM file"
+       $LFS mirror extend -N -E1M -L mdt -Eeof $tf &&
+               error "should not extend mirror with different DoM size"
+
+       return 0
+}
+run_test 6b "extend mirror with different DoM size"
 
 test_7() {
        local tf=$DIR/$tfile