Whamcloud - gitweb
LU-16904 tests: Fix sanity test 248c and 360 when PFL layout is used 18/54918/3
authorWei Liu <sarah@whamcloud.com>
Thu, 25 Apr 2024 18:35:13 +0000 (11:35 -0700)
committerOleg Drokin <green@whamcloud.com>
Wed, 5 Jun 2024 04:51:39 +0000 (04:51 +0000)
For 248c, use stripe counct 1 for root before the readahead issue described
in LU-17755 and LU-15155 get fixed
For 360, use stripe count 1 for test dir to make sure the files created under
it have object greater than 1M on single OST to test delayed iput

Test-Parameters: trivial
Test-Parameters: testlist=sanity env=fs_STRIPEPARAMS="-E 1M -c1 -E eof" env=ONLY="248c,360"
Test-Parameters: testlist=sanity env=fs_STRIPEPARAMS="-E 64k -c 1 -E eof" env=ONLY="248c,360"
Test-Parameters: testlist=sanity env=fs_STRIPEPARAMS="-E 64k -c 1 -E eof -c 2" env=ONLY="248c,360"
Test-Parameters: testlist=sanity env=fs_STRIPEPARAMS="-E 64k -c 1 -E 1M -c 2 -E eof -c 4 -S 4M" env=ONLY="248c,360"

Signed-off-by: Wei Liu <sarah@whamcloud.com>
Change-Id: I93341001714c5d0942f2f8f2895ca8bb545dc344
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54918
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Patrick Farrell <patrick.farrell@oracle.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/tests/sanity.sh

index 77d5ae0..de7ef96 100755 (executable)
@@ -24170,48 +24170,48 @@ test_248c() {
        # test
        local time1
        local time2
+       local counter
        local whole_mb=$($LCTL get_param -n llite.*.max_read_ahead_whole_mb)
-       stack_trap "$LCTL set_param llite.*.max_read_ahead_whole_mb=$whole_mb" EXIT
-       counter=0
+       stack_trap "$LCTL set_param llite.*.max_read_ahead_whole_mb=$whole_mb"
 
-       while [ $counter -lt 3 ]; do
-               # Increment the counter
-               ((counter++))
+       # LU-16904 Use stripe counct 1 for root before the readahead issue
+       # described in LU-17755 and LU-15155 get fixed
+       test_mkdir $DIR/$tdir || error "mkdir $tdir failed"
+       $LFS setstripe -c 1 $DIR/$tdir || error "setstripe $tdir failed"
 
+       for (( counter = 0; counter < 3; counter++ )); do
                $LCTL set_param llite.*.max_read_ahead_whole_mb=64
-               rm -f $DIR/$tfile
-               touch $DIR/$tfile || error "(0) failed to create file"
+               rm -f $DIR/$tdir/$tfile
+               touch $DIR/$tdir/$tfile || error "(0) failed to create file"
                # 64 MiB
-               $TRUNCATE $DIR/$tfile 67108864 || error "(1) failed to truncate file"
-               time1=$(dd if=$DIR/$tfile bs=4K of=/dev/null 2>&1 | awk '/bytes/ {print $8}')
+               $TRUNCATE $DIR/$tdir/$tfile 67108864 || error "(1) trunc failed"
+               time1=$(dd if=$DIR/$tdir/$tfile bs=4K of=/dev/null 2>&1 |
+                       awk '/bytes/ { print $8 }')
                echo "whole file readahead of 64 MiB took $time1 seconds"
                $LCTL get_param llite.*.read_ahead_stats
 
-               $LCTL set_param llite.*.read_ahead_stats=c
+               $LCTL set_param llite.*.read_ahead_stats=clear
                $LCTL set_param llite.*.max_read_ahead_whole_mb=8
-               rm -f $DIR/$tfile
-               touch $DIR/$tfile || error "(2) failed to create file"
+               rm -f $DIR/$tdir/$tfile
+               touch $DIR/$tdir/$tfile || error "(2) failed to create file"
                # 64 MiB
-               $TRUNCATE $DIR/$tfile 67108864 || error "(3) failed to create file"
-               time2=$(dd if=$DIR/$tfile bs=4K of=/dev/null 2>&1 | awk '/bytes/ {print $8}')
+               $TRUNCATE $DIR/$tdir/$tfile 67108864 || error "(3) trunc failed"
+               time2=$(dd if=$DIR/$tdir/$tfile bs=4K of=/dev/null 2>&1 |
+                       awk '/bytes/ { print $8 }')
                echo "non-whole file readahead of 64 MiB took $time2 seconds"
                $LCTL get_param llite.*.read_ahead_stats
 
                # Check if time1 is not more than 1.5 times2
                timecheck=$(echo "$time1 <= (1.5 * $time2)" | bc -l)
 
-               if [[ $timecheck -eq 1 ]]; then
+               if (( $timecheck == 1 )); then
                        echo "Test passed on attempt $counter"
-                       # Exit the loop
-                       counter=4
-               else
-                       echo "Attempt $counter failed: whole file readahead took: $time1, greater than non: $time2"
+                       break
                fi
+               echo "Try $counter failed: whole file readahead took: $time1, greater than non: $time2"
        done
-       if [ $counter -eq 3 ]; then
-               error "whole file readahead check failed 3 times in a row, probably not just VM lag"
-       fi
-
+       (( $counter < 3 )) ||
+               error "whole file readahead failed 3x, probably not just VM lag"
 }
 run_test 248c "verify whole file read behavior"
 
@@ -27756,6 +27756,11 @@ test_360() {
        stack_trap "do_facet ost1 $LCTL set_param $param=${old[0]}"
 
        mkdir $DIR/$tdir/
+       # LU-16904 Use stripe count 1 for test dir to make sure the files
+       # created under it have object greater than 1M on single OST
+       # to test delayed iput
+       $LFS setstripe -c 1 $DIR/$tdir/
+
        do_facet ost1 $LCTL set_param debug=+inode
        do_facet ost1 $LCTL clear
        local files=100