X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Fsanity.sh;h=1b72d2a9cc79fff5d17e7a017aa8cef96b3f172e;hp=df888590be5cb1efc65e7d565313895e049bcc33;hb=1aae733c16161513b07d7f8cc046299e2de5aad3;hpb=41f3c27adf160d3661db252e9046a783301a9830 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index df88859..1b72d2a 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1533,6 +1533,112 @@ test_27b() { } run_test 27b "create and write to two stripe file" +# 27c family tests specific striping, setstripe -o +test_27ca() { + [[ $OSTCOUNT -lt 2 ]] && skip_env "skipping 2-stripe test" + test_mkdir -p $DIR/$tdir + local osts="1" + + $LFS setstripe -o $osts $DIR/$tdir/$tfile || error "setstripe failed" + $LFS getstripe -i $DIR/$tdir/$tfile + [ $($LFS getstripe -i $DIR/$tdir/$tfile ) -eq $osts ] || + error "stripe not on specified OST" + + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 || error "dd failed" +} +run_test 27ca "one stripe on specified OST" + +test_27cb() { + [[ $OSTCOUNT -lt 2 ]] && skip_env "skipping 2-stripe test" + test_mkdir -p $DIR/$tdir + local osts="1,0" + $LFS setstripe -o $osts $DIR/$tdir/$tfile || error "setstripe failed" + local getstripe=$($LFS getstripe $DIR/$tdir/$tfile) + echo "$getstripe" + + # Strip getstripe output to a space separated list of OSTs + local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\ + awk '{print $1}' | tr '\n' '\ ' | sed -e 's/[[:space:]]*$//') + [ "$getstripe_osts" = "${osts//,/ }" ] || + error "stripes not on specified OSTs" + + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 || error "dd failed" +} +run_test 27cb "two stripes on specified OSTs" + +test_27cc() { + [[ $OSTCOUNT -lt 2 ]] && skip_env "skipping 2-stripe test" + [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] || + skip "server does not support overstriping" + + test_mkdir -p $DIR/$tdir + local osts="0,0" + $LFS setstripe -o $osts $DIR/$tdir/$tfile || error "setstripe failed" + local getstripe=$($LFS getstripe $DIR/$tdir/$tfile) + echo "$getstripe" + + # Strip getstripe output to a space separated list of OSTs + local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\ + awk '{print $1}' | tr '\n' '\ ' | sed -e 's/[[:space:]]*$//') + [ "$getstripe_osts" = "${osts//,/ }" ] || + error "stripes not on specified OSTs" + + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 || error "dd failed" +} +run_test 27cc "two stripes on the same OST" + +test_27cd() { + [[ $OSTCOUNT -lt 2 ]] && skip_env "skipping 2-stripe test" + [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] || + skip "server does not support overstriping" + test_mkdir -p $DIR/$tdir + local osts="0,1,1,0" + $LFS setstripe -o $osts $DIR/$tdir/$tfile || error "setstripe failed" + local getstripe=$($LFS getstripe $DIR/$tdir/$tfile) + echo "$getstripe" + + # Strip getstripe output to a space separated list of OSTs + local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\ + awk '{print $1}' | tr '\n' '\ ' | sed -e 's/[[:space:]]*$//') + [ "$getstripe_osts" = "${osts//,/ }" ] || + error "stripes not on specified OSTs" + + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 || error "dd failed" +} +run_test 27cd "four stripes on two OSTs" + +test_27ce() { + [[ $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] && + skip_env "too many osts, skipping" + [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] || + skip "server does not support overstriping" + # We do one more stripe than we have OSTs + [ $OSTCOUNT -ge 159 ] || large_xattr_enabled || + skip_env "ea_inode feature disabled" + + test_mkdir -p $DIR/$tdir + local osts="" + for i in $(seq 0 $OSTCOUNT); + do + osts=$osts"0" + if [ $i -ne $OSTCOUNT ]; then + osts=$osts"," + fi + done + $LFS setstripe -o $osts $DIR/$tdir/$tfile || error "setstripe failed" + local getstripe=$($LFS getstripe $DIR/$tdir/$tfile) + echo "$getstripe" + + # Strip getstripe output to a space separated list of OSTs + local getstripe_osts=$(echo "$getstripe" | sed -e '1,/obdidx/d' |\ + awk '{print $1}' | tr '\n' '\ ' | sed -e 's/[[:space:]]*$//') + [ "$getstripe_osts" = "${osts//,/ }" ] || + error "stripes not on specified OSTs" + + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 || error "dd failed" +} +run_test 27ce "more stripes than OSTs with -o" + test_27d() { test_mkdir $DIR/$tdir $LFS setstripe -c 0 -i -1 -S 0 $DIR/$tdir/$tfile || @@ -2188,7 +2294,8 @@ test_27B() { # LU-2523 } run_test 27B "call setstripe on open unlinked file/rename victim" -test_27C() { #LU-2871 +# 27C family tests full striping and overstriping +test_27Ca() { #LU-2871 [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs" declare -a ost_idx @@ -2224,7 +2331,143 @@ test_27C() { #LU-2871 done done } -run_test 27C "check full striping across all OSTs" +run_test 27Ca "check full striping across all OSTs" + +test_27Cb() { + [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] || + skip "server does not support overstriping" + [[ $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] && + skip_env "too many osts, skipping" + + test_mkdir -p $DIR/$tdir + local setcount=$(($OSTCOUNT * 2)) + [ $setcount -ge 160 ] || large_xattr_enabled || + skip_env "ea_inode feature disabled" + + $LFS setstripe -C $setcount $DIR/$tdir/$tfile || + error "setstripe failed" + + local count=$($LFS getstripe -c $DIR/$tdir/$tfile) + [ $count -eq $setcount ] || + error "stripe count $count, should be $setcount" + + $LFS getstripe $DIR/$tdir/$tfile 2>&1 | grep "overstriped" || + error "overstriped should be set in pattern" + + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 conv=notrunc || + error "dd failed" +} +run_test 27Cb "more stripes than OSTs with -C" + +test_27Cc() { + [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] || + skip "server does not support overstriping" + [[ $OSTCOUNT -lt 2 ]] && skip_env "need > 1 OST" + + test_mkdir -p $DIR/$tdir + local setcount=$(($OSTCOUNT - 1)) + + [ $setcount -ge 160 ] || large_xattr_enabled || + skip_env "ea_inode feature disabled" + + $LFS setstripe -C $setcount $DIR/$tdir/$tfile || + error "setstripe failed" + + local count=$($LFS getstripe -c $DIR/$tdir/$tfile) + [ $count -eq $setcount ] || + error "stripe count $count, should be $setcount" + + $LFS getstripe $DIR/$tdir/$tfile 2>&1 | grep "overstriped" && + error "overstriped should not be set in pattern" + + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 conv=notrunc || + error "dd failed" +} +run_test 27Cc "fewer stripes than OSTs does not set overstriping" + +test_27Cd() { + [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] || + skip "server does not support overstriping" + [[ $OSTCOUNT -lt 2 ]] && skip_env "need > 1 OST" + large_xattr_enabled || skip_env "ea_inode feature disabled" + + test_mkdir -p $DIR/$tdir + local setcount=$LOV_MAX_STRIPE_COUNT + + $LFS setstripe -C $setcount $DIR/$tdir/$tfile || + error "setstripe failed" + + local count=$($LFS getstripe -c $DIR/$tdir/$tfile) + [ $count -eq $setcount ] || + error "stripe count $count, should be $setcount" + + $LFS getstripe $DIR/$tdir/$tfile 2>&1 | grep "overstriped" || + error "overstriped should be set in pattern" + + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 conv=notrunc || + error "dd failed" + + rm -f $DIR/$tdir/$tfile || error "Delete $tfile failed" +} +run_test 27Cd "test maximum stripe count" + +test_27Ce() { + [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] || + skip "server does not support overstriping" + test_mkdir -p $DIR/$tdir + + pool_add $TESTNAME || error "Pool creation failed" + pool_add_targets $TESTNAME 0 || error "pool_add_targets failed" + + local setcount=8 + + $LFS setstripe -C $setcount -p "$TESTNAME" $DIR/$tdir/$tfile || + error "setstripe failed" + + local count=$($LFS getstripe -c $DIR/$tdir/$tfile) + [ $count -eq $setcount ] || + error "stripe count $count, should be $setcount" + + $LFS getstripe $DIR/$tdir/$tfile 2>&1 | grep "overstriped" || + error "overstriped should be set in pattern" + + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 conv=notrunc || + error "dd failed" + + rm -f $DIR/$tdir/$tfile || error "Delete $tfile failed" +} +run_test 27Ce "test pool with overstriping" + +test_27Cf() { + [[ $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ]] || + skip "server does not support overstriping" + [[ $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] && + skip_env "too many osts, skipping" + + test_mkdir -p $DIR/$tdir + + local setcount=$(($OSTCOUNT * 2)) + [ $setcount -ge 160 ] || large_xattr_enabled || + skip_env "ea_inode feature disabled" + + $LFS setstripe -C $setcount $DIR/$tdir/ || + error "setstripe failed" + + echo 1 > $DIR/$tdir/$tfile + + local count=$($LFS getstripe -c $DIR/$tdir/$tfile) + [ $count -eq $setcount ] || + error "stripe count $count, should be $setcount" + + $LFS getstripe $DIR/$tdir/$tfile 2>&1 | grep "overstriped" || + error "overstriped should be set in pattern" + + dd if=/dev/zero of=$DIR/$tdir/$tfile bs=1M count=4 conv=notrunc || + error "dd failed" + + rm -f $DIR/$tdir/$tfile || error "Delete $tfile failed" +} +run_test 27Cf "test default inheritance with overstriping" test_27D() { [ $OSTCOUNT -lt 2 ] && skip_env "needs >= 2 OSTs" @@ -2252,6 +2495,9 @@ test_27D() { [ $MDS1_VERSION -lt $(version_code 2.9.55) ] || [ $CLIENT_VERSION -lt $(version_code 2.9.55) ] && skip27D+=" -s 30,31" + [[ ! $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping || + $OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] && + skip27D+=" -s 32,33" llapi_layout_test -d$DIR/$tdir -p$POOL -o$OSTCOUNT $skip27D || error "llapi_layout_test failed" @@ -6702,6 +6948,39 @@ test_60g() { } run_test 60g "transaction abort won't cause MDT hung" +test_60h() { + [ $MDS1_VERSION -le $(version_code 2.12.52) ] || + skip "Need MDS version at least 2.12.52" + [ $MDSCOUNT -le 2 ] || skip "Need >= 2 MDTs" + + local f + + #define OBD_FAIL_MDS_STRIPE_CREATE 0x188 + #define OBD_FAIL_MDS_STRIPE_FID 0x189 + for fail_loc in 0x80000188 0x80000189; do + do_facet mds1 "$LCTL set_param fail_loc=$fail_loc" + $LFS mkdir -c $MDSCOUNT -i 0 $DIR/$tdir-$fail_loc || + error "mkdir $dir-$fail_loc failed" + for i in {0..10}; do + # create may fail on missing stripe + echo $i > $DIR/$tdir-$fail_loc/$i + done + $LFS getdirstripe $DIR/$tdir-$fail_loc || + error "getdirstripe $tdir-$fail_loc failed" + $LFS migrate -m 1 $DIR/$tdir-$fail_loc || + error "migrate $tdir-$fail_loc failed" + $LFS getdirstripe $DIR/$tdir-$fail_loc || + error "getdirstripe $tdir-$fail_loc failed" + pushd $DIR/$tdir-$fail_loc + for f in *; do + echo $f | cmp $f - || error "$f data mismatch" + done + popd + rm -rf $DIR/$tdir-$fail_loc + done +} +run_test 60h "striped directory with missing stripes can be accessed" + test_61a() { [ $PARALLEL == "yes" ] && skip "skip parallel run" @@ -6932,9 +7211,9 @@ test_65d() { if [[ $STRIPECOUNT -le 0 ]]; then sc=1 - elif [[ $STRIPECOUNT -gt 2000 ]]; then -#LOV_MAX_STRIPE_COUNT is 2000 - [[ $OSTCOUNT -gt 2000 ]] && sc=2000 || sc=$(($OSTCOUNT - 1)) + elif [[ $STRIPECOUNT -gt $LOV_MAX_STRIPE_COUNT ]]; then + [[ $OSTCOUNT -gt $LOV_MAX_STRIPE_COUNT ]] && + sc=$LOV_MAX_STRIPE_COUNT || sc=$(($OSTCOUNT - 1)) else sc=$(($STRIPECOUNT - 1)) fi @@ -17828,6 +18107,26 @@ test_271f() { } run_test 271f "DoM: read on open (200K file and read tail)" +test_271g() { + [[ $($LCTL get_param mdc.*.import) =~ async_discard ]] || + skip "Skipping due to old client or server version" + + $LFS setstripe -E 1024K -L mdt -E EOF $DIR1/$tfile + # to get layout + $CHECKSTAT -t file $DIR1/$tfile + + $MULTIOP $DIR1/$tfile Ow40960_w4096c & + MULTIOP_PID=$! + sleep 1 + #define OBD_FAIL_LDLM_CANCEL_BL_CB_RACE + $LCTL set_param fail_loc=0x80000314 + rm $DIR1/$tfile || error "Unlink fails" + RC=$? + kill -USR1 $MULTIOP_PID && wait $MULTIOP_PID || error "multiop failure" + [ $RC -eq 0 ] || error "Failed write to stale object" +} +run_test 271g "Discard DoM data vs client flush race" + test_272a() { [ $MDS1_VERSION -lt $(version_code 2.11.50) ] && skip "Need MDS version at least 2.11.50" @@ -20864,6 +21163,15 @@ test_813() { } run_test 813 "File heat verfication" +test_814() +{ + dd of=$DIR/$tfile seek=128 bs=1k < /dev/null + echo -n y >> $DIR/$tfile + cp --sparse=always $DIR/$tfile $DIR/${tfile}.cp || error "copy failed" + diff $DIR/$tfile $DIR/${tfile}.cp || error "files should be same" +} +run_test 814 "sparse cp works as expected (LU-12361)" + # # tests that do cleanup/setup should be run at the end #