Whamcloud - gitweb
LU-17468 lod: component add missed pattern info 17/53817/3
authorBobi Jam <bobijam@whamcloud.com>
Thu, 25 Jan 2024 03:56:42 +0000 (11:56 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Feb 2024 07:02:41 +0000 (07:02 +0000)
"lfs setstripe --commponent-add" missed setting component pattern,
which causes some setting missing, like overstriping.

Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I7ad746a550f1afea54a6f5b68823a79a85a44082
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53817
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/lod/lod_object.c
lustre/tests/sanity.sh

index 6dca2cb..cd07bed 100644 (file)
@@ -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.
index 8f4df71..21901a0 100755 (executable)
@@ -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"