generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 627
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3
4 #
5 # FSQA Test No. 627
6 #
7 # AIO/DIO stress test
8 # Run random AIO/DIO activity on an file system with unwritten regions
9 #
10 # This test verifies that the an unwritten extent is properly marked
11 # as written after writing into it.
12 #
13 # There was a hard-to-hit bug which would occasionally trigger with
14 # ext4 for which this test was a reproducer.  This has been fixed
15 # after moving ext4 to use iomap for Direct I/O's, although as of this
16 # writing, there are still some occasional failures on ext4 when block
17 # size < page size.
18 #
19 . ./common/preamble
20 _begin_fstest auto aio rw stress
21
22 fio_config=$tmp.fio
23 fio_out=$tmp.fio.out
24
25 # Import common functions.
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_fs generic
30 _require_test
31 _require_scratch
32 _require_odirect
33 _require_aio
34 _require_block_device $SCRATCH_DEV
35
36 NUM_JOBS=$((4*LOAD_FACTOR))
37 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
38 FILE_SIZE=$(((BLK_DEV_SIZE * 512) * 3 / 4))
39
40 max_file_size=$((5 * 1024 * 1024 * 1024))
41 if [ $max_file_size -lt $FILE_SIZE ]; then
42         FILE_SIZE=$max_file_size
43 fi
44 SIZE=$((FILE_SIZE / 2))
45
46 cat >$fio_config <<EOF
47 ###########
48 # $seq test fio activity
49 # Filenames derived from jobsname and jobid like follows:
50 # ${JOB_NAME}.${JOB_ID}.${ITERATION_ID}
51 [global]
52 ioengine=libaio
53 bs=128k
54 directory=${SCRATCH_MNT}
55 filesize=${FILE_SIZE}
56 size=${FILE_SIZE}
57 io_size=${SIZE}
58 iodepth=$((128*$LOAD_FACTOR))
59 fallocate=native
60
61 # Perform direct aio and verify data
62 # This test case should check use-after-free issues
63 [aio-dio-verifier]
64 numjobs=1
65 verify=crc32c-intel
66 verify_fatal=1
67 verify_dump=1
68 verify_backlog=1024
69 verify_async=4
70 direct=1
71 random_generator=lfsr
72 blocksize_range=4k-8200k
73 rw=randwrite
74 filename=test-file
75
76 EOF
77
78 _require_fio $fio_config
79 _require_xfs_io_command "falloc"
80
81 _scratch_mkfs >> $seqres.full 2>&1
82 _scratch_mount
83
84 echo ""
85 echo "Run fio with random aio-dio pattern"
86 echo ""
87 cat $fio_config >> $seqres.full
88 $FIO_PROG $fio_config --output=$fio_out
89 cat $fio_out >> $seqres.full
90
91 status=0
92 exit