X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fsanity-flr.sh;h=47ef7be6dab06f34a65696ad760043d7f362d5a7;hb=bb0a1075285076567bf9c3c406116682f0997579;hp=74cad1a150f0946fdd30315b8a2eb1061a443f0a;hpb=b8e6c8bdca9bd0e12d78cd4a06800c13f4293325;p=fs%2Flustre-release.git diff --git a/lustre/tests/sanity-flr.sh b/lustre/tests/sanity-flr.sh index 74cad1a..47ef7be 100644 --- a/lustre/tests/sanity-flr.sh +++ b/lustre/tests/sanity-flr.sh @@ -5,20 +5,21 @@ set -e set +o posix -SRCDIR=$(dirname $0) -export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin ONLY=${ONLY:-"$*"} -# Bug number for skipped test: LU-11381 -ALWAYS_EXCEPT="$SANITY_FLR_EXCEPT 201" -# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! -LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)} +LUSTRE=${LUSTRE:-$(dirname $0)/..} . $LUSTRE/tests/test-framework.sh init_test_env $@ -. ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} init_logging +ALWAYS_EXCEPT="$SANITY_FLR_EXCEPT " +# Bug number for skipped test: LU-11381 +ALWAYS_EXCEPT+=" 201" +# UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT! + +build_test_filter + [[ $(lustre_version_code $SINGLEMDS) -ge $(version_code 2.10.56) ]] || { skip "Need MDS version at least 2.10.56"; exit 0; } @@ -30,8 +31,6 @@ check_and_setup_lustre DIR=${DIR:-$MOUNT} assert_DIR -build_test_filter - assert_DIR rm -rf $DIR/[Rdfs][0-9]* @@ -381,6 +380,15 @@ test_0b() { verify_comp_attr stripe-count $tf ${ids[5]} $OSTCOUNT verify_comp_attr_with_parent pool $tf ${ids[5]} + if [ $MDS1_VERSION -ge $(version_code 2.12.55) ]; then + # LU-11022 - remove mirror by pool name + local=cnt cnt=$($LFS getstripe $tf | grep archive | wc -l) + [ "$cnt" != "1" ] && error "unexpected mirror count $cnt" + $LFS mirror split --pool archive -d $tf || error "delete mirror" + cnt=$($LFS getstripe $tf | grep archive | wc -l) + [ "$cnt" != "0" ] && error "mirror count after removal: $cnt" + fi + # destroy OST pool destroy_test_pools } @@ -674,6 +682,9 @@ test_0g() { run_test 0g "lfs mirror create flags support" test_0h() { + [ $MDS1_VERSION -lt $(version_code 2.11.57) ] && + skip "Need MDS version at least 2.11.57" + local td=$DIR/$tdir local tf=$td/$tfile local ids @@ -1060,10 +1071,8 @@ test_33() { start_osts 1 # read file again with ost2 failed - $LCTL set_param ldlm.namespaces.lustre-*-osc-[-0-9a-f]*.lru_size=clear - - fail ost2 & - sleep 1 + stop_osts 2 + drop_client_cache # check size, glimpse should work $CHECKSTAT -t file -s $fsize $DIR/$tfile || @@ -1074,7 +1083,7 @@ test_33() { [[ "$rs" == "ost1" ]] || error "file content error: expected: \"ost1\", actual: \"$rs\"" - wait_osc_import_state client ost2 FULL + start_osts 2 } run_test 33 "read can choose available mirror to read" @@ -1270,6 +1279,9 @@ create_files_37() { test_37() { + [ $MDS1_VERSION -lt $(version_code 2.11.57) ] && + skip "Need MDS version at least 2.11.57" + local tf=$DIR/$tfile local tf2=$DIR/$tfile-2 local tf3=$DIR/$tfile-3 @@ -1320,21 +1332,15 @@ test_37() local osts=$(comma_list $(osts_nodes)) - # define OBD_FAIL_OST_SKIP_LV_CHECK 0x241 - do_nodes $osts lctl set_param fail_loc=0x241 - - mirror_io copy -i ${mirror_array[0]} \ - -t $(echo ${mirror_array[@]:1} | tr ' ' ',') $tf || - error "mirror copy error" - - do_nodes $osts lctl set_param fail_loc=0 + $LFS mirror copy -i ${mirror_array[0]} -o-1 $tf || + error "mirror copy error" # verify copying is successful by checking checksums remount_client $MOUNT for i in ${mirror_array[@]}; do sum=$($LFS mirror read -N $i $tf | md5sum) [ "$sum" = "${checksums[1]}" ] || - error "$i: mismatch checksum after copy" + error "$i: mismatch checksum after copy \'$sum\'" done rm -f $tf @@ -1813,7 +1819,7 @@ test_44() { run_test 44 "lfs mirror split check" test_45() { - [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return + [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" local file=$DIR/$tdir/$tfile local dir=$DIR/$tdir/$dir @@ -1825,16 +1831,14 @@ test_45() { -N -E3m -S1m -Eeof -N -E8m -Eeof $file || error "Create $file failed" - echo "getstripe --yaml $file" - $LFS getstripe --yaml $file > $temp || error "getstripe $file failed" - echo "setstripe --yaml=$temp $file.2" - $LFS setstripe --yaml=$temp $file.2 || error "setstripe $file.2 failed" + verify_yaml_layout $file $file.copy $temp "1. FLR file" + rm -f $file $file.copy - echo "compare layout" - local layout1=$(get_layout_param $file) - local layout2=$(get_layout_param $file.2) - [ "$layout1" == "$layout2" ] || - error "FLR file $file/$file.2 layouts are not equal" + $LFS setstripe -N -E1m -S1m -c2 -o0,1 -E2m -Eeof -N -E4m -Eeof \ + -N -E3m -S1m -Eeof -N -E8m --flags=prefer -Eeof $file || + error "Create $file failed" + + verify_yaml_layout $file $file.copy $temp "2. FLR file with flags" } run_test 45 "Verify setstripe/getstripe with YAML with FLR file" @@ -1981,6 +1985,9 @@ test_47() { run_test 47 "Verify mirror obj alloc" test_48() { + [ $MDS1_VERSION -lt $(version_code 2.11.55) ] && + skip "Need MDS version at least 2.11.55" + local tf=$DIR/$tfile rm -f $tf @@ -2254,7 +2261,9 @@ test_202() { run_test 202 "lfs setstripe --add-component wide striping" test_203() { - [[ $OSTCOUNT -lt 2 ]] && skip "need >= 2 OSTs" && return + [ $MDS1_VERSION -lt $(version_code 2.11.55) ] && + skip "Need MDS version at least 2.11.55" + [[ $OSTCOUNT -lt 2 ]] && skip "need >= 2 OSTs" local tf=$DIR/$tfile @@ -2286,6 +2295,405 @@ test_203() { } run_test 203 "mirror file preserve mirror ID" +# Simple test of FLR + self-extending layout, SEL in non-primary mirror +test_204a() { + [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] && + skip "skipped for lustre < $SEL_VER" + + local comp_file=$DIR/$tdir/$tfile + local flg_opts="" + local found="" + + test_mkdir $DIR/$tdir + + # first mirror is 0-10M, then 10M-(-1), second mirror is 1M followed + # by extension space to -1 + $LFS setstripe -N -E 10M -E-1 -N -E 1M -E-1 -z64M $comp_file || + error "Create $comp_file failed" + + # Write to first component, extending & staling second mirror + dd if=/dev/zero bs=2M count=1 of=$comp_file conv=notrunc || + error "dd to extend + stale failed" + + $LFS getstripe $comp_file + + flg_opts="--component-flags init,stale" + found=$($LFS find --component-end 65M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "write: Second comp end incorrect" + + flg_opts="--component-flags extension" + found=$($LFS find --component-start 65M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "write: Third comp start incorrect" + + # mirror resync should not change the extents + $LFS mirror resync $comp_file + + flg_opts="--component-flags init" + found=$($LFS find --component-end 65M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: Second comp end incorrect" + + flg_opts="--component-flags extension" + found=$($LFS find --component-start 65M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: Third comp start incorrect" + + sel_layout_sanity $comp_file 5 + + rm -f $comp_file +} +run_test 204a "FLR write/stale/resync tests with self-extending mirror" + +# Simple test of FLR + self-extending layout, SEL in primary mirror +test_204b() { + [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] && + skip "skipped for lustre < $SEL_VER" + + local comp_file=$DIR/$tdir/$tfile + local flg_opts="" + local found="" + + test_mkdir $DIR/$tdir + + # first mirror is 1M followed by extension space to -1, second mirror + # is 0-10M, then 10M-(-1), + $LFS setstripe -N -E 1M -E-1 -z64M -N -E 10M -E-1 $comp_file || + error "Create $comp_file failed" + + # Write to first component, extending first component & staling + # other mirror + dd if=/dev/zero bs=2M count=1 of=$comp_file conv=notrunc || + error "dd to extend + stale failed" + + $LFS getstripe $comp_file + + flg_opts="--component-flags init" + found=$($LFS find --component-end 65M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "write: First comp end incorrect" + + flg_opts="--component-flags extension" + found=$($LFS find --component-start 65M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "write: Second comp start incorrect" + + flg_opts="--component-flags init,stale" + found=$($LFS find --component-end 10M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "write: First mirror comp flags incorrect" + + # This component is staled because it overlaps the extended first + # component of the primary mirror, even though it doesn't overlap + # the actual write - thus not inited. + flg_opts="--component-flags stale" + found=$($LFS find --component-start 10M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "write: Second mirror comp flags incorrect" + + # mirror resync should not change the extents + $LFS mirror resync $comp_file + + $LFS getstripe $comp_file + + flg_opts="--component-flags init" + found=$($LFS find --component-end 65M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: First comp end incorrect" + + flg_opts="--component-flags extension" + found=$($LFS find --component-start 65M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: Second comp start incorrect" + + flg_opts="--component-flags init" + found=$($LFS find --component-end 10M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: First mirror comp flags incorrect" + + flg_opts="--component-flags init" + found=$($LFS find --component-start 10M $flg_opts $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: Second mirror comp flags incorrect" + + sel_layout_sanity $comp_file 5 + + rm -f $comp_file +} +run_test 204b "FLR write/stale/resync tests with self-extending primary" + +# FLR + SEL failed extension & component removal +# extension space in second mirror +test_204c() { + [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return + [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] && + skip "skipped for lustre < $SEL_VER" + + local comp_file=$DIR/$tdir/$tfile + local found="" + local ost_idx1=0 + local ost_name=$(ostname_from_index $ost_idx1) + + test_mkdir $DIR/$tdir + + # first mirror is is 0-10M, then 10M-(-1), second mirror is 0-1M, then + # extension space from 1M to 1G, then normal space to -1 + $LFS setstripe -N -E 10M -E-1 -N -E 1M -E 1G -i $ost_idx1 -z 64M \ + -E -1 $comp_file || error "Create $comp_file failed" + + do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=1 + sleep_maxage + + # write to first comp (0 - 10M) of mirror 1, extending + staling + # first + second comp of mirror 2 + dd if=/dev/zero bs=2M count=1 of=$comp_file conv=notrunc + RC=$? + + do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=0 + sleep_maxage + + [ $RC -eq 0 ] || error "dd to extend + stale failed" + + $LFS getstripe $comp_file + + found=$($LFS find --component-start 0m --component-end 1m \ + --comp-flags init,stale $comp_file | wc -l) + [ $found -eq 1 ] || error "write: First mirror comp incorrect" + + found=$($LFS find --component-start 1m --component-end EOF \ + --comp-flags stale,^init $comp_file | wc -l) + [ $found -eq 1 ] || error "write: Second mirror comp incorrect" + + local mirror_id=$($LFS getstripe --component-start=1m \ + --component-end=EOF $comp_file | \ + grep lcme_mirror_id | awk '{ print $2 }') + + [[ $mirror_id -eq 2 ]] || + error "component not in correct mirror? $mirror_id" + + $LFS mirror resync $comp_file + + $LFS getstripe $comp_file + + # component dimensions should not change from resync + found=$($LFS find --component-start 1m --component-end EOF \ + --component-flags init $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: Second mirror comp incorrect" + + sel_layout_sanity $comp_file 4 + + rm -f $comp_file +} +run_test 204c "FLR write/stale/resync test with component removal" + +# Successful repeated component in primary mirror +test_204d() { + [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return + [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] && + skip "skipped for lustre < $SEL_VERSION" + + local comp_file=$DIR/$tdir/$tfile + local found="" + + wait_delete_completed + wait_mds_ost_sync + test_mkdir $DIR/$tdir + + # first mirror is 64M followed by extension space to -1, second mirror + # is 0-10M, then 10M-(-1) + $LFS setstripe -N -E-1 -z64M -N -E 10M -E-1 $comp_file || + error "Create $comp_file failed" + + local ost_idx1=$($LFS getstripe -I65537 -i $comp_file) + local ost_name=$(ostname_from_index $ost_idx1) + # degrade OST for first comp so we won't extend there + do_facet ost$((ost_idx1+1)) $LCTL set_param -n \ + obdfilter.$ost_name.degraded=1 + sleep_maxage + + # Write beyond first component, causing repeat & stale second mirror + dd if=/dev/zero bs=1M count=1 seek=66 of=$comp_file conv=notrunc + RC=$? + + do_facet ost$((ost_idx1+1)) $LCTL set_param -n \ + obdfilter.$ost_name.degraded=0 + sleep_maxage + + [ $RC -eq 0 ] || error "dd to repeat & stale failed" + + $LFS getstripe $comp_file + + found=$($LFS find --component-start 64m --component-end 128m \ + --component-flags init $comp_file | wc -l) + [ $found -eq 1 ] || error "write: Repeat comp incorrect" + + local ost_idx2=$($LFS getstripe --component-start=64m \ + --component-end=128m --component-flags=init \ + -i $comp_file) + [[ $ost_idx1 -eq $ost_idx2 ]] && error "$ost_idx1 == $ost_idx2" + local mirror_id=$($LFS getstripe --component-start=64m \ + --component-end=128m --component-flags=init \ + $comp_file | grep lcme_mirror_id | awk '{ print $2 }') + [[ $mirror_id -eq 1 ]] || + error "component not in correct mirror: $mirror_id, not 1" + + $LFS mirror resync $comp_file + + $LFS getstripe $comp_file + + # component dimensions should not change from resync + found=$($LFS find --component-start 0m --component-end 64m \ + --component-flags init $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: first comp incorrect" + found=$($LFS find --component-start 64m --component-end 128m \ + --component-flags init $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: repeat comp incorrect" + + sel_layout_sanity $comp_file 5 + + rm -f $comp_file +} +run_test 204d "FLR write/stale/resync sel test with repeated comp" + +# Successful repeated component, SEL in non-primary mirror +test_204e() { + [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return + [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] && + skip "skipped for lustre < $SEL_VERSION" + + local comp_file=$DIR/$tdir/$tfile + local found="" + + wait_delete_completed + wait_mds_ost_sync + + test_mkdir $DIR/$tdir + + # first mirror is is 0-100M, then 100M-(-1), second mirror is extension + # space to -1 (-z 64M, so first comp is 0-64M) + # Note: we have to place both 1st components on OST0, otherwise 2 OSTs + # will be not enough - one will be degraded, the other is used on + # an overlapping mirror. + $LFS setstripe -N -E 100M -i 0 -E-1 -N -E-1 -i 0 -z 64M $comp_file || + error "Create $comp_file failed" + + local ost_idx1=$($LFS getstripe --component-start=0 \ + --component-end=64m -i $comp_file) + local ost_name=$(ostname_from_index $ost_idx1) + # degrade OST for first comp of 2nd mirror so we won't extend there + do_facet ost$((ost_idx1+1)) $LCTL set_param -n \ + obdfilter.$ost_name.degraded=1 + sleep_maxage + + $LFS getstripe $comp_file + + # Write to first component, stale & instantiate second mirror components + # overlapping with the written component (0-100M); + dd if=/dev/zero bs=2M count=1 of=$comp_file conv=notrunc + RC=$? + + do_facet ost$((ost_idx1+1)) $LCTL set_param -n \ + obdfilter.$ost_name.degraded=0 + sleep_maxage + $LFS getstripe $comp_file + + [ $RC -eq 0 ] || error "dd to repeat & stale failed" + + found=$($LFS find --component-start 0m --component-end 64m \ + --component-flags init,stale $comp_file | wc -l) + [ $found -eq 1 ] || error "write: first comp incorrect" + + # was repeated due to degraded ost + found=$($LFS find --component-start 64m --component-end 128m \ + --component-flags init,stale $comp_file | wc -l) + [ $found -eq 1 ] || error "write: repeated comp incorrect" + + local ost_idx2=$($LFS getstripe --component-start=64m \ + --component-end=128m --component-flags=init \ + -i $comp_file) + [[ $ost_idx1 -eq $ost_idx2 ]] && error "$ost_idx1 == $ost_idx2" + local mirror_id=$($LFS getstripe --component-start=0m \ + --component-end=64m --component-flags=init \ + $comp_file | grep lcme_mirror_id | awk '{ print $2 }') + [[ $mirror_id -eq 2 ]] || + error "component not in correct mirror? $mirror_id" + + $LFS mirror resync $comp_file + + $LFS getstripe $comp_file + + # component dimensions should not change from resync + found=$($LFS find --component-start 0m --component-end 64m \ + --component-flags init,^stale $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: first comp incorrect" + found=$($LFS find --component-start 64m --component-end 128m \ + --component-flags init,^stale $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: repeated comp incorrect" + + sel_layout_sanity $comp_file 5 + + rm -f $comp_file +} +run_test 204e "FLR write/stale/resync sel test with repeated comp" + +# FLR + SEL: failed repeated component, SEL in non-primary mirror +test_204f() { + [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return + [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] && + skip "skipped for lustre < $SEL_VERSION" + + local comp_file=$DIR/$tdir/$tfile + local found="" + + wait_delete_completed + wait_mds_ost_sync + test_mkdir $DIR/$tdir + + pool_add $TESTNAME || error "Pool creation failed" + pool_add_targets $TESTNAME 0 1 || error "Pool add targets failed" + + # first mirror is is 0-100M, then 100M-(-1), second mirror is extension + # space to -1 (-z 64M, so first comp is 0-64M) + $LFS setstripe -N -E 100M -E-1 -N --pool="$TESTNAME" \ + -E-1 -c 1 -z 64M $comp_file || error "Create $comp_file failed" + + local ost_name0=$(ostname_from_index 0) + local ost_name1=$(ostname_from_index 1) + + # degrade both OSTs in pool, so we'll try to repeat, then fail and + # extend original comp + do_facet ost1 $LCTL set_param -n obdfilter.$ost_name0.degraded=1 + do_facet ost2 $LCTL set_param -n obdfilter.$ost_name1.degraded=1 + sleep_maxage + + # a write to the 1st component, 100M length, which will try to stale + # the first 100M of mirror 2, attempting to extend its 0-64M component + dd if=/dev/zero bs=2M count=1 of=$comp_file conv=notrunc + RC=$? + + do_facet ost1 $LCTL set_param -n obdfilter.$ost_name0.degraded=0 + do_facet ost2 $LCTL set_param -n obdfilter.$ost_name1.degraded=0 + sleep_maxage + + [ $RC -eq 0 ] || error "dd to extend mirror comp failed" + + $LFS getstripe $comp_file + + found=$($LFS find --component-start 0m --component-end 128m \ + --component-flags init,stale $comp_file | wc -l) + [ $found -eq 1 ] || error "write: First mirror comp incorrect" + + local mirror_id=$($LFS getstripe --component-start=0m \ + --component-end=128m --component-flags=init \ + $comp_file | grep lcme_mirror_id | awk '{ print $2 }') + + [[ $mirror_id -eq 2 ]] || + error "component not in correct mirror? $mirror_id, not 2" + + $LFS mirror resync $comp_file + + $LFS getstripe $comp_file + + # component dimensions should not change from resync + found=$($LFS find --component-start 0m --component-end 128m \ + --component-flags init,^stale $comp_file | wc -l) + [ $found -eq 1 ] || error "resync: First mirror comp incorrect" + + sel_layout_sanity $comp_file 4 + + rm -f $comp_file +} +run_test 204f "FLR write/stale/resync sel w/forced extension" + complete $SECONDS check_and_cleanup_lustre exit_status