2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2017 SUSE Linux Products GmbH. All Rights Reserved.
5 # FS QA Test No. generic/439
7 # Test that if we punch a hole in a file, with either a range that goes beyond
8 # the file's size or covers a file range that is already a hole, and that if
9 # after we do some buffered write operations that cover different parts of the
10 # hole, no warnings are emmitted in syslog/dmesg and the file's content is
11 # correct after remounting the filesystem.
14 _begin_fstest auto quick punch
16 # Import common functions.
19 # real QA test starts here
23 _require_xfs_io_command "fpunch"
25 _scratch_mkfs >>$seqres.full 2>&1
28 $XFS_IO_PROG -f -c "pwrite -S 0xaa 0 100K" $SCRATCH_MNT/f | _filter_xfs_io
29 $XFS_IO_PROG -c "fpunch 60K 90K" $SCRATCH_MNT/f
30 $XFS_IO_PROG -c "pwrite -S 0xbb -b 100K 50K 100K" $SCRATCH_MNT/f | _filter_xfs_io
31 $XFS_IO_PROG -c "pwrite -S 0xcc -b 50K 100K 50K" $SCRATCH_MNT/f | _filter_xfs_io
33 $XFS_IO_PROG -f -c "fpunch 695K 820K" $SCRATCH_MNT/f2
34 $XFS_IO_PROG -c "pwrite -S 0xaa 1008K 307K" $SCRATCH_MNT/f2 | _filter_xfs_io
35 $XFS_IO_PROG -c "pwrite -S 0xbb -b 630K 1073K 630K" $SCRATCH_MNT/f2 \
37 $XFS_IO_PROG -c "pwrite -S 0xcc -b 459K 1068K 459K" $SCRATCH_MNT/f2 \
42 echo "File f contents after remounting filesystem:"
43 od -t x1 $SCRATCH_MNT/f
44 echo "File f2 contents after remounting filesystem:"
45 od -t x1 $SCRATCH_MNT/f2