From: Bobi Jam Date: Tue, 5 Sep 2023 06:54:44 +0000 (+0800) Subject: LU-17088 dom: don't create different size DOM component X-Git-Tag: 2.15.59~139 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F69%2F52269%2F2;p=fs%2Flustre-release.git LU-17088 dom: don't create different size DOM component 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 Change-Id: Ia0d08c697dbeeb3aa8d20d9849226afa06360012 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52269 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Mikhail Pershin Reviewed-by: Oleg Drokin --- diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index 81324ef..b8f1b74 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -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); diff --git a/lustre/lov/lov_object.c b/lustre/lov/lov_object.c index 0cbbd1b..40d2cb6 100644 --- a/lustre/lov/lov_object.c +++ b/lustre/lov/lov_object.c @@ -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; diff --git a/lustre/tests/sanity-flr.sh b/lustre/tests/sanity-flr.sh index cb5d889..c19cb9a 100644 --- a/lustre/tests/sanity-flr.sh +++ b/lustre/tests/sanity-flr.sh @@ -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