Whamcloud - gitweb
LU-7149 tests: restore writethrough_cache_enable
[fs/lustre-release.git] / lustre / tests / sanity.sh
index c2d49ac..8516e09 100755 (executable)
@@ -6155,6 +6155,11 @@ run_test 77j "client only supporting ADLER32"
 rm -f $F77_TMP
 unset F77_TMP
 
+cleanup_test_78() {
+       trap 0
+       rm -f $DIR/$tfile
+}
+
 test_78() { # bug 10901
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        remote_ost || { skip_env "local OST" && return; }
@@ -6184,6 +6189,8 @@ test_78() { # bug 10901
        [[ $SMALLESTOST -lt 10240 ]] &&
                skip "too small OSTSIZE, useless to run large O_DIRECT test" && return 0
 
+       trap cleanup_test_78 EXIT
+
        [[ $F78SIZE -gt $((SMALLESTOST * $OSTCOUNT / 1024 - 80)) ]] &&
                F78SIZE=$((SMALLESTOST * $OSTCOUNT / 1024 - 80))
 
@@ -6196,7 +6203,7 @@ test_78() { # bug 10901
                $DIRECTIO rdwr $DIR/$tfile 0 $FSIZE 1048576||error "rdwr failed"
        done
 
-       rm -f $DIR/$tfile
+       cleanup_test_78
 }
 run_test 78 "handle large O_DIRECT writes correctly ============"
 
@@ -10416,67 +10423,114 @@ test_155_big_load() {
     true
 }
 
+save_writethrough() {
+       local facets=$(get_facets OST)
+
+       save_lustre_params $facets "obdfilter.*.writethrough_cache_enable" > $1
+       save_lustre_params $facets "osd-*.*.writethrough_cache_enable" >> $1
+}
+
 test_155a() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+       save_writethrough $p
+
        set_cache read on
        set_cache writethrough on
        test_155_small_load
+       restore_lustre_params < $p
+       rm -f $p
 }
 run_test 155a "Verify small file correctness: read cache:on write_cache:on"
 
 test_155b() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+       save_writethrough $p
+
        set_cache read on
        set_cache writethrough off
        test_155_small_load
+       restore_lustre_params < $p
+       rm -f $p
 }
 run_test 155b "Verify small file correctness: read cache:on write_cache:off"
 
 test_155c() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+       save_writethrough $p
+
        set_cache read off
        set_cache writethrough on
        test_155_small_load
+       restore_lustre_params < $p
+       rm -f $p
 }
 run_test 155c "Verify small file correctness: read cache:off write_cache:on"
 
 test_155d() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+       save_writethrough $p
+
        set_cache read off
        set_cache writethrough off
        test_155_small_load
+       restore_lustre_params < $p
+       rm -f $p
 }
 run_test 155d "Verify small file correctness: read cache:off write_cache:off"
 
 test_155e() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+       save_writethrough $p
+
        set_cache read on
        set_cache writethrough on
        test_155_big_load
+       restore_lustre_params < $p
+       rm -f $p
 }
 run_test 155e "Verify big file correctness: read cache:on write_cache:on"
 
 test_155f() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+       save_writethrough $p
+
        set_cache read on
        set_cache writethrough off
        test_155_big_load
+       restore_lustre_params < $p
+       rm -f $p
 }
 run_test 155f "Verify big file correctness: read cache:on write_cache:off"
 
 test_155g() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+       save_writethrough $p
+
        set_cache read off
        set_cache writethrough on
        test_155_big_load
+       restore_lustre_params < $p
+       rm -f $p
 }
 run_test 155g "Verify big file correctness: read cache:off write_cache:on"
 
 test_155h() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+       save_writethrough $p
+
        set_cache read off
        set_cache writethrough off
        test_155_big_load
+       restore_lustre_params < $p
+       rm -f $p
 }
 run_test 155h "Verify big file correctness: read cache:off write_cache:off"
 
@@ -10487,12 +10541,14 @@ test_156() {
        local BEFORE
        local AFTER
        local file="$DIR/$tfile"
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
 
        [ "$(facet_fstype ost1)" = "zfs" -a \
           $(lustre_version_code ost1 -lt $(version_code 2.6.93)) ] &&
                skip "LU-1956/LU-2261: stats not implemented on OSD ZFS" &&
                return
 
+       save_writethrough $p
        roc_hit_init
 
        log "Turn on read and write cache"
@@ -10621,6 +10677,8 @@ test_156() {
        fi
 
        rm -f $file
+       restore_lustre_params < $p
+       rm -f $p
 }
 run_test 156 "Verification of tunables"
 
@@ -12573,6 +12631,11 @@ run_test 224b "Don't panic on bulk IO failure"
 test_224c() { # LU-6441
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        remote_mds_nodsh && skip "remote MDS with nodsh" && return
+
+       local p="$TMP/$TESTSUITE-$TESTNAME.parameters"
+       save_writethrough $p
+       set_cache writethrough on
+
        local pages_per_rpc=$($LCTL get_param \
                                osc.*.max_pages_per_rpc)
        local at_max=$($LCTL get_param -n at_max)
@@ -12601,6 +12664,8 @@ test_224c() { # LU-6441
                $timeout || error "conf_param timeout=$timeout failed"
 
        $LCTL set_param -n $pages_per_rpc
+       restore_lustre_params < $p
+       rm -f $p
 }
 run_test 224c "Don't hang if one of md lost during large bulk RPC"
 
@@ -15402,6 +15467,29 @@ test_406() {
 }
 run_test 406 "DNE support fs default striping"
 
+test_407() {
+       [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return
+
+       [[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.8.55) ]] &&
+               skip "Need MDS version at least 2.8.55" && return
+
+       $LFS mkdir -i 0 -c 1 $DIR/$tdir.0 ||
+               error "$LFS mkdir -i 0 -c 1 $tdir.0 failed"
+       $LFS mkdir -i 1 -c 1 $DIR/$tdir.1 ||
+               error "$LFS mkdir -i 1 -c 1 $tdir.1 failed"
+       touch $DIR/$tdir.0/$tfile.0 || error "touch $tdir.0/$tfile.0 failed"
+
+       #define OBD_FAIL_DT_TXN_STOP    0x2019
+       for idx in $(seq $MDSCOUNT); do
+               do_facet mds$idx "lctl set_param fail_loc=0x2019"
+       done
+       $LFS mkdir -c 2 $DIR/$tdir && error "$LFS mkdir -c 2 $tdir should fail"
+       mv $DIR/$tdir.0/$tfile.0 $DIR/$tdir.1/$tfile.1 &&
+               error "mv $tdir.0/$tfile.0 $tdir.1/$tfile.1 should fail"
+       true
+}
+run_test 407 "transaction fail should cause operation fail"
+
 #
 # tests that do cleanup/setup should be run at the end
 #