Whamcloud - gitweb
LU-17088 dom: don't create different size DOM component
authorBobi Jam <bobijam@whamcloud.com>
Tue, 5 Sep 2023 06:54:44 +0000 (14:54 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 14 Oct 2023 10:49:48 +0000 (10:49 +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.

Lustre-change: https://review.whamcloud.com/52269
Lustre-commit: e2539c0667525aff8d985d018c4ed077d95ba882

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

index 22d5c41..29400d9 100644 (file)
@@ -1289,6 +1289,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;
@@ -1445,6 +1446,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 dc6ea6d..eff1a08 100644 (file)
@@ -618,7 +618,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 1a32309..197e98d 100644 (file)
@@ -871,7 +871,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"
 
@@ -895,7 +895,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.14.0.106) )) ||
+               skip "MDS version older than 2.14.0.106"
+
+       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