2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
7 # Create an unwritten extent, set up dm-error, try an AIO DIO write, then
8 # make sure we can't read back old disk contents.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
22 rm -rf $tmp.* $testdir $TEST_DIR/moo
26 # get standard environment, filters and checks
31 # real QA test starts here
34 _require_dm_target error
35 _require_xfs_io_command "falloc"
36 # This test uses "dm" without taking into account the data could be on
37 # realtime subvolume, thus the test will fail with rtinherit=1
39 _require_aiodio "aiocp"
40 AIO_TEST="src/aio-dio-regress/aiocp"
45 fssize=$((196 * 1048576))
46 echo "Format and mount"
47 $XFS_IO_PROG -d -c "pwrite -S 0x69 -b 1048576 0 $fssize" $SCRATCH_DEV >> $seqres.full
48 _scratch_mkfs_sized $fssize > $seqres.full 2>&1
50 _dmerror_mount >> $seqres.full 2>&1
54 testdir=$SCRATCH_MNT/test-$seq
60 filesize=$((blksz * nr))
61 bufsize=$((blksz * bufnr))
62 alignment=`_min_dio_alignment $TEST_DEV`
64 _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 5 / 4))
66 echo "Create the original files"
67 $XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
72 md5sum $testdir/file2 | _filter_scratch
74 echo "CoW and unmount"
75 $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
76 $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
78 _dmerror_load_error_table
79 $AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
80 _dmerror_load_working_table
85 md5sum $testdir/file2 | _filter_scratch
87 echo "Check for damage"
90 _repair_scratch_fs >> $seqres.full