5 # Run random AIO/DIO activity and fallocate/truncate simultaneously
6 # Test will operate on huge sparsed files so ENOSPC is expected.
8 #-----------------------------------------------------------------------
9 # (c) 2013 Dmitry Monakhov
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 seqres=$RESULT_DIR/$seq
30 seqres=$RESULT_DIR/$seq
31 echo "QA output created by $seq"
35 status=1 # failure is the default!
36 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
38 # get standard environment, filters and checks
42 # real QA test starts here
48 NUM_JOBS=$((4*LOAD_FACTOR))
49 BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
50 FILE_SIZE=$((BLK_DEV_SIZE * 512))
52 cat >$tmp-$seq.fio <<EOF
54 # $seq test fio activity
55 # Filenames derived from jobsname and jobid like follows:
56 # ${JOB_NAME}.${JOB_ID}.${ITERATION_ID}
60 directory=${SCRATCH_MNT}
63 iodepth=128*${LOAD_FACTOR}
64 continue_on_error=write
71 ## Perform direct aio, to files which may be truncated
78 runtime=100*${TIME_FACTOR}
81 # Perform direct aio and verify data
82 # This test case should check use-after-free issues
94 filename=aio-dio-verifier
96 # Perform buffered aio and verify data
97 # This test case should check use-after-free issues
98 [buffered-aio-verifier]
110 filename=buffered-aio-verifier
113 _require_fio $tmp-$seq.fio
118 echo "Run fio with random aio-dio pattern"
120 cat $tmp-$seq.fio >> $seqres.full
121 run_check $FIO_PROG $tmp-$seq.fio &
123 echo "Start fallocate/truncate loop"
127 for ((k=1; k <= NUM_JOBS; k++))
129 fallocate -l $FILE_SIZE $SCRATCH_MNT/direct_aio.$k.0 \
132 for ((k=1; k <= NUM_JOBS; k++))
134 truncate -s 0 $SCRATCH_MNT/direct_aio.$k.0
136 # Following like will check that pid is still run.
137 # Once fio exit we can stop fallocate/truncate loop
138 kill -0 $pid > /dev/null 2>&1 || break
143 _scratch_mkfs >> $seqres.full 2>&1
147 umount $SCRATCH_DEV 2>/dev/null
151 if ! _scratch_unmount; then
152 echo "failed to umount"