From: Mikhail Pershin Date: Thu, 9 Nov 2017 17:35:43 +0000 (+0300) Subject: LU-3285 tests: disable kernel flusher in discard tests X-Git-Tag: 2.10.56~34 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F16%2F30016%2F3;p=fs%2Flustre-release.git LU-3285 tests: disable kernel flusher in discard tests Test 101 checks that client discards data instead of flush, but it is not reliable because write RPC may happens before unlink command is executed due to kernel flusher. Set /proc/sys/vm/dirty_writeback_centisecs to 0 for the test time and return it back to the default value later. Signed-off-by: Mikhail Pershin Change-Id: I2c4da039a456519e25c6d9ffcc015c5baa479740 Reviewed-on: https://review.whamcloud.com/30016 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 249844a..456d311 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -4094,17 +4094,24 @@ test_100d() { } run_test 100d "DoM: write+truncate vs stat without IO lock (combined file)" - test_101a() { $LFS setstripe -E 1024K -L mdt -E EOF $DIR1/$tfile - lctl set_param -n mdc.*.stats=clear # to get layout $CHECKSTAT -t file $DIR1/$tfile + + OLD_VAL=$(cat /proc/sys/vm/dirty_writeback_centisecs) + echo 0 > /proc/sys/vm/dirty_writeback_centisecs + echo $OLD_VAL + # open + IO lock - dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || error "Write fails" + dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || + error_noexit "Write fails" # must discard pages - rm $DIR2/$tfile || error "Unlink fails" + lctl set_param -n mdc.*.stats=clear + rm $DIR2/$tfile || error_noexit "Unlink fails" local writes=$(lctl get_param -n mdc.*.stats | grep ost_write | wc -l) + echo $OLD_VAL > /proc/sys/vm/dirty_writeback_centisecs + [ $writes -eq 0 ] || error "Found WRITE RPC but expect none" } run_test 101a "Discard DoM data on unlink" @@ -4112,33 +4119,46 @@ run_test 101a "Discard DoM data on unlink" test_101b() { $LFS setstripe -E 1024K -L mdt -E EOF $DIR1/$tfile touch $DIR1/${tfile}_2 - lctl set_param -n mdc.*.stats=clear # to get layout $CHECKSTAT -t file $DIR1/$tfile + + OLD_VAL=$(cat /proc/sys/vm/dirty_writeback_centisecs) + echo 0 > /proc/sys/vm/dirty_writeback_centisecs + echo $OLD_VAL + # open + IO lock - dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || error "Write fails" + dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || + error_noexit "Write fails" # must discard pages - mv $DIR2/${tfile}_2 $DIR2/$tfile || error "Rename fails" + lctl set_param -n mdc.*.stats=clear + mv $DIR2/${tfile}_2 $DIR2/$tfile || error_noexit "Rename fails" local writes=$(lctl get_param -n mdc.*.stats | grep ost_write | wc -l) + echo $OLD_VAL > /proc/sys/vm/dirty_writeback_centisecs [ $writes -eq 0 ] || error "Found WRITE RPC but expect none" } run_test 101b "Discard DoM data on rename" test_101c() { $LFS setstripe -E 1024K -L mdt -E EOF $DIR1/$tfile - lctl set_param -n mdc.*.stats=clear # to get layout $CHECKSTAT -t file $DIR1/$tfile - # open + IO lock - dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || error "Write fails" + OLD_VAL=$(cat /proc/sys/vm/dirty_writeback_centisecs) + echo 0 > /proc/sys/vm/dirty_writeback_centisecs + echo $OLD_VAL + + # open + IO lock + dd if=/dev/zero of=$DIR1/$tfile bs=4096 count=1 || + error_noexit "Write fails" $MULTIOP $DIR1/$tfile O_c & MULTIOP_PID=$! - sleep 2 - rm $DIR2/$tfile > /dev/null || error "Unlink fails" - kill -USR1 $MULTIOP_PID || return 2 - wait $MULTIOP_PID || return 3 + sleep 1 + lctl set_param -n mdc.*.stats=clear + rm $DIR2/$tfile > /dev/null || error_noexit "Unlink fails" + kill -USR1 $MULTIOP_PID && wait $MULTIOP_PID || + error_noexit "multiop failure" local writes=$(lctl get_param -n mdc.*.stats | grep ost_write | wc -l) + echo $OLD_VAL > /proc/sys/vm/dirty_writeback_centisecs [ $writes -eq 0 ] || error "Found WRITE RPC but expect none" } run_test 101c "Discard DoM data on close-unlink"