From 90c093b7850c17be9a3a37331725e7881552f8a3 Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Thu, 25 Jan 2024 11:56:42 +0800 Subject: [PATCH] LU-17468 lod: component add missed pattern info "lfs setstripe --commponent-add" missed setting component pattern, which causes some setting missing, like overstriping. Signed-off-by: Bobi Jam Change-Id: I7ad746a550f1afea54a6f5b68823a79a85a44082 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53817 Reviewed-by: Andreas Dilger Reviewed-by: Artem Blagodarenko Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- lustre/lod/lod_object.c | 1 + lustre/tests/sanity.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 6dca2cb..cd07bed 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -2830,6 +2830,7 @@ static int lod_declare_layout_add(const struct lu_env *env, lod_comp->llc_stripe_size = v1->lmm_stripe_size; lod_comp->llc_stripe_count = v1->lmm_stripe_count; + lod_comp->llc_pattern = v1->lmm_pattern; /** * limit stripe count so that it's less than/equal to * extent_size / stripe_size. diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 8f4df71..21901a0 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -2628,6 +2628,36 @@ test_27Cg() { } run_test 27Cg "test setstripe with wrong OST idx" +test_27Ci() { + local tf=$DIR/$tfile + + stack_trap "rm -f $DIR/$tfile" + + $LFS setstripe -E1M $tf || error "create $tf failed" + $LFS setstripe -Eeof --component-add -C 100 $tf || + error "add component failed" + + $LFS getstripe -I2 $tf | awk '/lmm_pattern/ { print $2 }' | + grep "overstriped" || { + $LFS getstripe $tf + echo "lose overstriping setting" + } + sc=$($LFS getstripe -I2 --stripe-count $tf) + (( $sc == 100 )) || { + $LFS getstripe $tf + echo "lose overstriping setting" + } + + stack_trap "rm -f $tf" + dd if=/dev/zero of=$tf bs=1M count=10 || error "write $tf" + sc=$($LFS getstripe -I2 --stripe-count $tf) + (( $sc == 100 )) || { + $LFS getstripe $tf + echo "lose overstriping setting after instantiation" + } +} +run_test 27Ci "add an overstriping component" + test_27D() { [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" [ -n "$FILESET" ] && skip "SKIP due to FILESET set" -- 1.8.3.1