2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2019 Red Hat, Inc. All Rights Reserved.
5 # FS QA Test No. generic/567
7 # Test mapped writes against punch-hole to ensure we get the data
8 # correctly written. This can expose data corruption bugs on filesystems
9 # where the block size is smaller than the page size.
11 # (generic/029 is a similar test but for truncate.)
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
28 # get standard environment, filters and checks
32 # real QA test starts here
36 _require_xfs_io_command "fpunch"
38 testfile=$SCRATCH_MNT/testfile
40 _scratch_mkfs > /dev/null 2>&1
43 # Punch a hole straddling two pages to check that the mapped write after the
44 # hole-punching is correctly handled.
47 -c "pwrite -S 0x58 0 12288" \
48 -c "mmap -rw 0 12288" \
49 -c "mwrite -S 0x5a 2048 8192" \
50 -c "fpunch 2048 8192" \
51 -c "mwrite -S 0x59 2048 8192" \
53 $testfile | _filter_xfs_io
55 echo "==== Pre-Remount ==="
58 echo "==== Post-Remount =="