2 # SPDX-License-Identifier: GPL-2.0
8 # Run random AIO/DIO activity and fallocate/truncate simultaneously
9 # Test will operate on huge sparsed files so ENOSPC is expected.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
21 # get standard environment, filters and checks
25 # real QA test starts here
30 _require_block_device $SCRATCH_DEV
32 NUM_JOBS=$((4*LOAD_FACTOR))
33 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
34 FILE_SIZE=$((BLK_DEV_SIZE * 512))
36 cat >$fio_config <<EOF
38 # $seq test fio activity
39 # Filenames derived from jobsname and jobid like follows:
40 # ${JOB_NAME}.${JOB_ID}.${ITERATION_ID}
44 directory=${SCRATCH_MNT}
47 iodepth=128*${LOAD_FACTOR}
48 continue_on_error=write
55 ## Perform direct aio, to files which may be truncated
62 runtime=100*${TIME_FACTOR}
65 # Perform direct aio and verify data
66 # This test case should check use-after-free issues
78 filename=aio-dio-verifier
80 # Perform buffered aio and verify data
81 # This test case should check use-after-free issues
82 [buffered-aio-verifier]
94 filename=buffered-aio-verifier
99 _require_fio $fio_config
100 _require_xfs_io_command "falloc"
105 echo "Run fio with random aio-dio pattern"
107 cat $fio_config >> $seqres.full
108 run_check $FIO_PROG $fio_config &
110 echo "Start fallocate/truncate loop"
114 for ((k=1; k <= NUM_JOBS; k++))
116 $XFS_IO_PROG -f -c "falloc 0 $FILE_SIZE" \
117 $SCRATCH_MNT/direct_aio.$k.0 >> $seqres.full 2>&1
119 for ((k=1; k <= NUM_JOBS; k++))
121 $XFS_IO_PROG -c "truncate 0" \
122 $SCRATCH_MNT/direct_aio.$k.0 >> $seqres.full 2>&1
124 # Following like will check that pid is still run.
125 # Once fio exit we can stop fallocate/truncate loop
126 pgrep -f "$FIO_PROG" > /dev/null 2>&1 || break
131 _scratch_mkfs >> $seqres.full 2>&1
135 _scratch_unmount 2>/dev/null
139 if ! _scratch_unmount; then
140 echo "failed to umount"