X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Freplay-dual.sh;h=6197ff999781c62e46e088b0cf845b573ba686ba;hb=a42a91c783903ea15ad902032166c7e312dad7ee;hp=1f1c8ab8b71c617cf7ae892b1da5e7214fe1be02;hpb=30be03b4dd593894687773d2a460d441d85f88a2;p=fs%2Flustre-release.git diff --git a/lustre/tests/replay-dual.sh b/lustre/tests/replay-dual.sh index 1f1c8ab..6197ff9 100755 --- a/lustre/tests/replay-dual.sh +++ b/lustre/tests/replay-dual.sh @@ -1,11 +1,9 @@ #!/bin/bash -# -*- mode: Bash; tab-width: 4; indent-tabs-mode: t; -*- -# vim:shiftwidth=4:softtabstop=4:tabstop=4: set -e -# bug number: LU-2012 10124 -ALWAYS_EXCEPT="14b 15c $REPLAY_DUAL_EXCEPT" +# bug number: LU-2012 10124 LU-7372 +ALWAYS_EXCEPT="14b 15c 26 $REPLAY_DUAL_EXCEPT" SAVE_PWD=$PWD PTLDEBUG=${PTLDEBUG:--1} @@ -22,6 +20,7 @@ init_logging remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0 +# 7 (min)" [ "$SLOW" = "no" ] && EXCEPT_SLOW="21b" [[ $(facet_fstype $SINGLEMDS) == zfs ]] && @@ -254,23 +253,25 @@ test_10() { run_test 10 "resending a replayed unlink" test_11() { - replay_barrier $SINGLEMDS - mcreate $MOUNT1/$tfile-1 - mcreate $MOUNT2/$tfile-2 - mcreate $MOUNT1/$tfile-3 - mcreate $MOUNT2/$tfile-4 - mcreate $MOUNT1/$tfile-5 - # drop all reint replies for a while - do_facet $SINGLEMDS lctl set_param fail_loc=0x0119 - # note that with this fail_loc set, facet_failover df will fail - facet_failover $SINGLEMDS - #sleep for while, let both clients reconnect and timeout - sleep $((TIMEOUT * 2)) - do_facet $SINGLEMDS lctl set_param fail_loc=0 + replay_barrier $SINGLEMDS + mcreate $DIR1/$tfile-1 + mcreate $DIR2/$tfile-2 + mcreate $DIR1/$tfile-3 + mcreate $DIR2/$tfile-4 + mcreate $DIR1/$tfile-5 + # drop all reint replies for a while + do_facet $SINGLEMDS $LCTL set_param fail_loc=0x0119 + # note that with this fail_loc set, facet_failover df will fail + facet_failover $SINGLEMDS - rm $MOUNT1/$tfile-[1-5] || return 1 + local clients=${CLIENTS:-$HOSTNAME} + wait_clients_import_state "$clients" $SINGLEMDS FULL - return 0 + do_facet $SINGLEMDS $LCTL set_param fail_loc=0 + + rm $DIR1/$tfile-[1-5] || return 1 + + return 0 } run_test 11 "both clients timeout during replay" @@ -437,11 +438,11 @@ test_18() { # bug 3822 - evicting client with enqueued lock local DLMTRACE=$(do_facet $SINGLEMDS lctl get_param debug) do_facet $SINGLEMDS lctl set_param debug=+dlmtrace mkdir -p $MOUNT1/$tdir || error "mkdir $MOUNT1/$tdir failed" - touch $MOUNT1/$tdir/$tfile - #define OBD_FAIL_LDLM_ENQUEUE_BLOCKED 0x30b - statmany -s $MOUNT1/$tdir/f 1 500 & + touch $MOUNT1/$tdir/${tfile}0 || error "touch file failed" + statmany -s $MOUNT1/$tdir/$tfile 1 500 & OPENPID=$! - NOW=$(date +%s) + NOW=$SECONDS + #define OBD_FAIL_LDLM_ENQUEUE_BLOCKED 0x30b do_facet $SINGLEMDS lctl set_param fail_loc=0x8000030b # hold enqueue sleep 1 #define OBD_FAIL_LDLM_BL_CALLBACK_NET 0x305 @@ -471,27 +472,29 @@ test_19() { # Bug 10991 - resend of open request does not fail assertion. run_test 19 "resend of open request" test_20() { #16389 - BEFORE=`date +%s` - replay_barrier $SINGLEMDS - touch $MOUNT1/a - touch $MOUNT2/b - umount $MOUNT2 - fail $SINGLEMDS - rm $MOUNT1/a - zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail" - TIER1=$((`date +%s` - BEFORE)) - BEFORE=`date +%s` - replay_barrier $SINGLEMDS - touch $MOUNT1/a - touch $MOUNT2/b - umount $MOUNT2 - fail $SINGLEMDS - rm $MOUNT1/a - zconf_mount `hostname` $MOUNT2 || error "mount $MOUNT2 fail" - TIER2=$((`date +%s` - BEFORE)) - [ $TIER2 -ge $((TIER1 * 2)) ] && \ - error "recovery time is growing $TIER2 > $TIER1" - return 0 + local before=$SECONDS + replay_barrier $SINGLEMDS + touch $DIR1/$tfile.a + touch $DIR2/$tfile.b + umount $DIR2 + fail $SINGLEMDS + rm $DIR1/$tfile.a + zconf_mount $HOSTNAME $DIR2 || error "mount $DIR2 fail" + local tier1=$((SECONDS - before)) + + before=$SECONDS + replay_barrier $SINGLEMDS + touch $DIR1/$tfile.a + touch $DIR2/$tfile.b + umount $DIR2 + fail $SINGLEMDS + rm $DIR1/$tfile.a + zconf_mount $HOSTNAME $DIR2 || error "mount $DIR2 fail" + local tier2=$((SECONDS - before)) + + # timeout is more than 1.5x original timeout + ((tier2 < tier1 * 6 / 4)) || + error "recovery time $tier2 >= 1.5x original time $tier1" } run_test 20 "recovery time is not increasing" @@ -523,75 +526,76 @@ test_21a() { run_test 21a "commit on sharing" test_21b_sub () { - local mds=$1 - do_node $CLIENT1 rm -f $MOUNT1/$tfile-* + local mds=$1 + do_node $CLIENT1 rm -f $MOUNT1/$tfile-* - do_facet $mds sync - do_node $CLIENT1 touch $MOUNT1/$tfile-1 - do_node $CLIENT2 mv $MOUNT1/$tfile-1 $MOUNT1/$tfile-2 - do_node $CLIENT1 mv $MOUNT1/$tfile-2 $MOUNT1/$tfile-3 + do_facet $mds sync + do_node $CLIENT1 touch $MOUNT1/$tfile-1 + do_node $CLIENT2 mv $MOUNT1/$tfile-1 $MOUNT1/$tfile-2 + do_node $CLIENT1 mv $MOUNT1/$tfile-2 $MOUNT1/$tfile-3 - replay_barrier_nosync $mds - shutdown_client $CLIENT2 $MOUNT1 + replay_barrier_nosync $mds + shutdown_client $CLIENT2 $MOUNT1 - facet_failover $mds + facet_failover $mds - # were renames replayed? - local rc=0 - echo UNLINK $MOUNT1/$tfile-3 - do_node $CLIENT1 unlink $MOUNT1/$tfile-3 || \ - { echo "unlink $tfile-3 fail!" && rc=1; } + # were renames replayed? + local rc=0 + echo UNLINK $MOUNT1/$tfile-3 + do_node $CLIENT1 unlink $MOUNT1/$tfile-3 || + { echo "unlink $tfile-3 fail!" && rc=1; } - boot_node $CLIENT2 - zconf_mount_clients $CLIENT2 $MOUNT1 || error "mount $CLIENT2 $MOUNT1 fail" + boot_node $CLIENT2 + zconf_mount_clients $CLIENT2 $MOUNT1 || + error "mount $CLIENT2 $MOUNT1 fail" - return $rc + return $rc } test_21b() { - [ -z "$CLIENTS" ] && skip "Need two or more clients." && return - [ $CLIENTCOUNT -lt 2 ] && \ - { skip "Need two or more clients, have $CLIENTCOUNT" && return; } - - if [ "$FAILURE_MODE" = "HARD" ] && mixed_mdt_devs; then - skip "Several mdt services on one mds node are used with FAILURE_MODE=$FAILURE_MODE. " - return 0 - fi + [ -z "$CLIENTS" ] && skip "Need two or more clients" && return + [ $CLIENTCOUNT -lt 2 ] && + { skip "Need 2+ clients, have $CLIENTCOUNT" && return; } + if [ "$FAILURE_MODE" = "HARD" ] && mixed_mdt_devs; then + skip "Several MDTs on one MDS with FAILURE_MODE=$FAILURE_MODE" + return 0 + fi - zconf_umount_clients $CLIENTS $MOUNT2 - zconf_mount_clients $CLIENTS $MOUNT1 + zconf_umount_clients $CLIENTS $MOUNT2 + zconf_mount_clients $CLIENTS $MOUNT1 - local param_file=$TMP/$tfile-params + local param_file=$TMP/$tfile-params - local num=$(get_mds_dir $MOUNT1) + local mdtidx=$($LFS getstripe -M $MOUNT1) + local facet=mds$((mdtidx + 1)) - save_lustre_params mds$num "mdt.*.commit_on_sharing" > $param_file + save_lustre_params $facet "mdt.*.commit_on_sharing" > $param_file - # COS enabled - local COS=1 - do_facet mds$num lctl set_param mdt.*.commit_on_sharing=$COS + # COS enabled + local COS=1 + do_facet $facet lctl set_param mdt.*.commit_on_sharing=$COS - test_21b_sub mds$num || error "Not all renames are replayed. COS=$COS" + test_21b_sub $facet || error "Not all renames are replayed. COS=$COS" - # COS disabled (should fail) - COS=0 - do_facet mds$num lctl set_param mdt.*.commit_on_sharing=$COS + # there is still a window when transactions may be written to disk + # before the mds device is set R/O. To avoid such a rare test failure, + # the check is repeated several times. + COS=0 + local n_attempts=1 + while true; do + # COS disabled (should fail) + do_facet $facet lctl set_param mdt.*.commit_on_sharing=$COS - # there is still a window when transactions may be written to disk before - # the mds device is set R/O. To avoid such a rare test failure, the check - # is repeated several times. - local n_attempts=1 - while true; do - test_21b_sub mds$num || break; - let n_attempts=n_attempts+1 - [ $n_attempts -gt 3 ] && - error "The test cannot check whether COS works or not: all renames are replied w/o COS" - done - zconf_mount_clients $CLIENTS $MOUNT2 - restore_lustre_params < $param_file - rm -f $param_file - return 0 + test_21b_sub $facet || break + n_attempts=$((n_attempts + 1)) + [ $n_attempts -gt 3 ] && + error "can't check if COS works: rename replied w/o COS" + done + zconf_mount_clients $CLIENTS $MOUNT2 + restore_lustre_params < $param_file + rm -f $param_file + return 0 } run_test 21b "commit on sharing, two clients" @@ -865,7 +869,7 @@ run_test 23d "c1 rmdir d1, M0 drop update reply and fail M0/M1, c2 mkdir d1" test_24 () { [[ $(lustre_version_code $SINGLEMDS) -gt $(version_code 2.5.2) ]] || - { skip "Need MDS version newer than 2.5.2"; return 0; } + { skip "Need MDS version newer than 2.5.2"; return 0; } touch $MOUNT/$tfile stat $MOUNT/$tfile >&/dev/null @@ -898,9 +902,15 @@ test_25() { drop_ldlm_cancel "multiop $DIR2/$tfile Ow512" & sleep 1 -#define OBD_FAIL_OST_LDLM_REPLY_NET 0x213 # failover, replay and resend replayed waiting locks - do_facet ost1 lctl set_param fail_loc=0x80000213 + if [ $(lustre_version_code ost1) -ge $(version_code 2.6.90) ]; then + #define OBD_FAIL_LDLM_SRV_CP_AST 0x325 + do_facet ost1 lctl set_param fail_loc=0x80000325 + else + #define OBD_FAIL_OST_LDLM_REPLY_NET 0x213 + do_facet ost1 lctl set_param fail_loc=0x80000213 + fi + fail ost1 # multiop does not finish because CP AST is skipped; @@ -911,8 +921,111 @@ test_25() { } run_test 25 "replay|resend" +cleanup_26() { + trap 0 + kill -9 $tar_26_pid + kill -9 $dbench_26_pid + killall -9 dbench +} + +test_26() { + local clients=${CLIENTS:-$HOSTNAME} + + zconf_mount_clients $clients $MOUNT + + local duration=600 + [ "$SLOW" = "no" ] && duration=200 + # set duration to 900 because it takes some time to boot node + [ "$FAILURE_MODE" = HARD ] && duration=900 + + local start_ts=$SECONDS + local rc=0 + + trap cleanup_26 EXIT + ( + local tar_dir=$DIR/$tdir/run_tar + while true; do + test_mkdir -p -c$MDSCOUNT $tar_dir || break + if [ $MDSCOUNT -ge 2 ]; then + $LFS setdirstripe -D -c$MDSCOUNT $tar_dir || + error "set default dirstripe failed" + fi + cd $tar_dir || break + tar cf - /etc | tar xf - || error "tar failed" + cd $DIR/$tdir || break + rm -rf $tar_dir || break + done + )& + tar_26_pid=$! + echo "Started tar $tar_26_pid" + + ( + local dbench_dir=$DIR2/$tdir/run_dbench + while true; do + test_mkdir -p -c$MDSCOUNT $dbench_dir || break + if [ $MDSCOUNT -ge 2 ]; then + $LFS setdirstripe -D -c$MDSCOUNT $dbench_dir || + error "set default dirstripe failed" + fi + cd $dbench_dir || break + rundbench 1 -D $dbench_dir -t 100 > /dev/null 2&>1 || + break + cd $DIR/$tdir || break + rm -rf $dbench_dir || break + done + )& + dbench_26_pid=$! + echo "Started dbench $dbench_26_pid" + + local num_failovers=0 + local fail_index=1 + while [ $((SECONDS - start_ts)) -lt $duration ]; do + kill -0 $tar_26_pid || error "tar $tar_26_pid missing" + kill -0 $dbench_26_pid || error "dbench $dbench_26_pid missing" + sleep 2 + replay_barrier mds$fail_index + sleep 2 # give clients a time to do operations + # Increment the number of failovers + num_failovers=$((num_failovers + 1)) + log "$TESTNAME fail mds$fail_index $num_failovers times" + fail mds$fail_index + if [ $fail_index -ge $MDSCOUNT ]; then + fail_index=1 + else + fail_index=$((fail_index + 1)) + fi + done + # stop the client loads + kill -0 $tar_26_pid || error "tar $tar_26_pid stopped" + kill -0 $dbench_26_pid || error "dbench $dbench_26_pid stopped" + cleanup_26 || true +} +run_test 26 "dbench and tar with mds failover" + +test_28() { + $SETSTRIPE -i 0 -c 1 $DIR2/$tfile + dd if=/dev/zero of=$DIR2/$tfile bs=4096 count=1 + + #define OBD_FAIL_LDLM_SRV_BL_AST 0x324 + do_facet ost1 $LCTL set_param fail_loc=0x80000324 + + dd if=/dev/zero of=$DIR/$tfile bs=4096 count=1 & + local pid=$! + sleep 2 + + #define OBD_FAIL_LDLM_GRANT_CHECK 0x32a + do_facet ost1 $LCTL set_param fail_loc=0x32a + + fail ost1 + + sleep 2 + cancel_lru_locks OST0000-osc + wait $pid || error "dd failed" +} +run_test 28 "lock replay should be ordered: waiting after granted" + complete $SECONDS -SLEEP=$((`date +%s` - $NOW)) +SLEEP=$((SECONDS - $NOW)) [ $SLEEP -lt $TIMEOUT ] && sleep $SLEEP [ "$MOUNTED2" = yes ] && zconf_umount $HOSTNAME $MOUNT2 || true check_and_cleanup_lustre