2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2010 Red Hat, Inc. All Rights Reserved.
7 # Test for race between direct I/O and mmap
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 7 15
21 rm -f $tmp.* $testfile
25 # get standard environment, filters and checks
29 # real QA test starts here
31 # Modify as appropriate.
35 # this test leaves a 512MB file around if we abort the test during the run via a
36 # reboot or kernel panic. Hence just name the file $seq so that we can always
37 # clean up on the next run and not leave large stale files around on the testdir
38 # that can lead to ENOSPC issues over time.
39 testfile=$TEST_DIR/$seq
46 dd if=/dev/zero of=$testfile bs=$iosize count=$loops &> /dev/null
50 # Direct I/O overwriter
51 dd if=/dev/zero of=$testfile oflag=direct bs=$iosize count=$loops conv=notrunc &> /dev/null &
55 start=`expr $loops - 1`
56 for i in `seq $start -1 0`
58 offset=`expr $i \* $iosize`
59 $XFS_IO_PROG -f -c "mmap -w $offset $iosize" -c "mwrite $offset $iosize" $testfile
65 echo "Silence is golden."
67 # unmount and check dmesg, filtering out expected warnings about mixed
70 _check_dmesg _filter_aiodio_dmesg