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.
36 # this test leaves a 512MB file around if we abort the test during the run via a
37 # reboot or kernel panic. Hence just name the file $seq so that we can always
38 # clean up on the next run and not leave large stale files around on the testdir
39 # that can lead to ENOSPC issues over time.
40 testfile=$TEST_DIR/$seq
47 dd if=/dev/zero of=$testfile bs=$iosize count=$loops &> /dev/null
51 # Direct I/O overwriter
52 dd if=/dev/zero of=$testfile oflag=direct bs=$iosize count=$loops conv=notrunc &> /dev/null &
56 start=`expr $loops - 1`
57 for i in `seq $start -1 0`
59 offset=`expr $i \* $iosize`
60 $XFS_IO_PROG -f -c "mmap -w $offset $iosize" -c "mwrite $offset $iosize" $testfile
66 echo "Silence is golden."
68 # unmount and check dmesg, filtering out expected warnings about mixed
71 _check_dmesg _filter_aiodio_dmesg