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 a 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
26 # get standard environment, filters and checks
31 # real QA test starts here
34 _require_dm_target error
35 _require_xfs_io_command "falloc"
37 # This test uses "dm" without taking into account the data could be on
38 # realtime subvolume, thus the test will fail with rtinherit=1
43 fssize=$((100 * 1048576))
44 echo "Format and mount"
45 $XFS_IO_PROG -d -c "pwrite -S 0x69 -b 1048576 0 $fssize" $SCRATCH_DEV >> $seqres.full
46 _scratch_mkfs_sized $fssize > $seqres.full 2>&1
48 _dmerror_mount >> $seqres.full 2>&1
52 testdir=$SCRATCH_MNT/test-$seq
58 filesize=$((blksz * nr))
59 bufsize=$((blksz * bufnr))
61 _require_fs_space $SCRATCH_MNT $((filesize / 1024 * 5 / 4))
63 echo "Create the original files"
64 $XFS_IO_PROG -f -c "falloc 0 $filesize" $testdir/file2 >> $seqres.full
69 md5sum $testdir/file2 | _filter_scratch
71 echo "Write and unmount"
72 $XFS_IO_PROG -f -c "pwrite -S 0x63 $bufsize 1" $testdir/file2 >> $seqres.full
74 _dmerror_load_error_table
75 $XFS_IO_PROG -d -f -c "pwrite -S 0x63 -b $bufsize 0 $filesize" $testdir/file2 \
77 _dmerror_load_working_table
82 md5sum $testdir/file2 | _filter_scratch
84 echo "Check for damage"
87 _repair_scratch_fs >> $seqres.full