Whamcloud - gitweb
LU-15483 tests: Improve test 398b 21/44321/15
authorPatrick Farrell <pfarrell@whamcloud.com>
Thu, 15 Jul 2021 19:15:12 +0000 (15:15 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 11 Jun 2022 05:31:30 +0000 (05:31 +0000)
Test 398b is currently only writing 3 MiB (12 MiB/4) of
data from each thread in the racing set (4 DIO, 4 BIO).
This is such a small amount that it's probably finishing
too quickly to generate the intended overlap & races most
of the time.

It also currently writes only at PAGE_SIZE, which excludes
a lot of possible races.

This is currently a pretty fast test - ~ 2 seconds on my
local machine, similar on Maloo - so let's have it write 4
times more data and use 4 different block sizes, so it will
hit more races.

This is 16x more I/O, but the test still only takes around
16 seconds on my local machine.

This is motivated by difficulties dealing with rare
failures while developing the LU-13799 patch series and
hoping to make them easier to catch.

Test-Parameters: trivial testlist=sanity env=ONLY=398b,ONLY_REPEAT=50
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I1092023a526c085dfacd1bd112c2ebb714da63e5
Reviewed-on: https://review.whamcloud.com/44321
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Wang Shilong <wangshilong1991@gmail.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity.sh

index 7130179..a016ff3 100755 (executable)
@@ -24373,25 +24373,37 @@ run_test 398a "direct IO should cancel lock otherwise lockless"
 
 test_398b() { # LU-4198
        which fio || skip_env "no fio installed"
-       $LFS setstripe -c -1 $DIR/$tfile
+       $LFS setstripe -c -1 -S 1M $DIR/$tfile
 
-       local size=12
+       local size=48
        dd if=/dev/zero of=$DIR/$tfile bs=1M count=$size
 
        local njobs=4
-       echo "mix direct rw ${size}M to OST0 by fio with $njobs jobs..."
-       fio --name=rand-rw --rw=randrw --bs=$PAGE_SIZE --direct=1 \
-               --numjobs=$njobs --fallocate=none \
-               --iodepth=16 --allow_file_create=0 --size=$((size/njobs))M \
-               --filename=$DIR/$tfile &
-       bg_pid=$!
-
-       echo "mix buffer rw ${size}M to OST0 by fio with $njobs jobs..."
-       fio --name=rand-rw --rw=randrw --bs=$PAGE_SIZE \
-               --numjobs=$njobs --fallocate=none \
-               --iodepth=16 --allow_file_create=0 --size=$((size/njobs))M \
-               --filename=$DIR/$tfile || true
-       wait $bg_pid
+       # Single page, multiple pages, stripe size, 4*stripe size
+       for bsize in $(( $PAGE_SIZE )) $(( 4*$PAGE_SIZE )) 1048576 4194304; do
+               echo "mix direct rw ${bsize} by fio with $njobs jobs..."
+               fio --name=rand-rw --rw=randrw --bs=$bsize --direct=1 \
+                       --numjobs=$njobs --fallocate=none \
+                       --iodepth=16 --allow_file_create=0 --size=$((size/njobs))M \
+                       --filename=$DIR/$tfile &
+               bg_pid=$!
+
+               echo "mix buffer rw ${bsize} by fio with $njobs jobs..."
+               fio --name=rand-rw --rw=randrw --bs=$bsize \
+                       --numjobs=$njobs --fallocate=none \
+                       --iodepth=16 --allow_file_create=0 --size=$((size/njobs))M \
+                       --filename=$DIR/$tfile || true
+               wait $bg_pid
+       done
+
+       evict=$(do_facet client $LCTL get_param \
+               osc.$FSNAME-OST*-osc-*/state |
+           awk -F"[ [,]" '/EVICTED ]$/ { if (t<$5) {t=$5;} } END { print t }')
+
+       [ -z "$evict" ] || [[ $evict -le $before ]] ||
+               (do_facet client $LCTL get_param \
+                       osc.$FSNAME-OST*-osc-*/state;
+                   error "eviction happened: $evict before:$before")
 
        rm -f $DIR/$tfile
 }