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
33 _require_dm_target error
34 _require_xfs_io_command "falloc"
35 # This test uses "dm" without taking into account the data could be on
36 # realtime subvolume, thus the test will fail with rtinherit=1
38 _require_aiodio "aiocp"
39 AIO_TEST="$here/src/aio-dio-regress/aiocp"
44 fssize=$((196 * 1048576))
45 echo "Format and mount"
46 $XFS_IO_PROG -d -c "pwrite -S 0x69 -b 1048576 0 $fssize" $SCRATCH_DEV >> $seqres.full
47 _scratch_mkfs_sized $fssize > $seqres.full 2>&1
49 _dmerror_mount >> $seqres.full 2>&1
53 testdir=$SCRATCH_MNT/test-$seq
59 filesize=$((blksz * nr))
60 bufsize=$((blksz * bufnr))
61 alignment=`_min_dio_alignment $TEST_DEV`
63 _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 5 / 4))
65 echo "Create the original files"
66 $XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
71 md5sum $testdir/file2 | _filter_scratch
73 echo "CoW and unmount"
74 $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
75 $XFS_IO_PROG -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $TEST_DIR/moo >> $seqres.full
77 _dmerror_load_error_table
78 $AIO_TEST -a $alignment -f DIRECT -b $bufsize $TEST_DIR/moo $testdir/file2 >> $seqres.full
79 _dmerror_load_working_table
84 md5sum $testdir/file2 | _filter_scratch
86 echo "Check for damage"
89 _repair_scratch_fs >> $seqres.full