Whamcloud - gitweb
LU-3285 tests: disable kernel flusher in discard tests 16/30016/3
authorMikhail Pershin <mike.pershin@intel.com>
Thu, 9 Nov 2017 17:35:43 +0000 (20:35 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 29 Nov 2017 05:59:10 +0000 (05:59 +0000)
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 <mike.pershin@intel.com>
Change-Id: I2c4da039a456519e25c6d9ffcc015c5baa479740
Reviewed-on: https://review.whamcloud.com/30016
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanityn.sh

index 249844a..456d311 100755 (executable)
@@ -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"