2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Red Hat, Inc. All Rights Reserved.
7 # Test stale data exposure via writeback using various file allocation
8 # modification commands. The presumption is that such commands result in partial
9 # writeback and can convert a delayed allocation extent, that might be larger
10 # than the ranged affected by fallocate, to a normal extent. If the fs happens
11 # to crash sometime between when the extent modification is logged and writeback
12 # occurs for dirty pages within the extent but outside of the fallocated range,
13 # stale data exposure can occur.
16 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
21 status=1 # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
30 # get standard environment, filters and checks
35 # real QA test starts here
41 img=$SCRATCH_MNT/$seq.img
42 mnt=$SCRATCH_MNT/$seq.mnt
45 # Create an fs on a small, initialized image. The pattern is written to
46 # the image to detect stale data exposure.
47 $XFS_IO_PROG -f -c "truncate 0" -c "pwrite 0 25M" $img \
49 _mkfs_dev $img >> $seqres.full 2>&1
56 # write, run the test command and shutdown the fs
57 $XFS_IO_PROG -f -c "pwrite -S 1 0 64k" -c "$cmd 60k 4k" $file | \
64 # we generally expect a zero-sized file (this should be silent)
70 # Modify as appropriate.
74 _require_scratch_shutdown
75 _require_xfs_io_command "falloc"
76 _require_xfs_io_command "fpunch"
77 _require_xfs_io_command "fzero"
79 _scratch_mkfs >/dev/null 2>&1
80 _require_local_device $SCRATCH_DEV
81 _require_metadata_journaling $SCRATCH_DEV
84 _crashtest "falloc -k"