2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc. All Rights Reserved.
7 # Ensure that reflinking into a file well beyond EOF zeroes everything between
8 # the old EOF and the start of the newly linked chunk. This is an adaptation
9 # of a reproducer script that Eric Sandeen formulated from a stale data
10 # exposure bug uncovered by shared/010.
13 _begin_fstest auto quick clone
15 # Import common functions.
19 # real QA test starts here
21 _require_scratch_reflink
22 _require_xfs_io_command "falloc"
24 # Fill disk with a well known pattern so that stale data exposure becomes much
26 $XFS_IO_PROG -c "pwrite -S 0x58 -b 1m 0 300m" $SCRATCH_DEV >> $seqres.full
27 _scratch_mkfs_sized $((300 * 1048576)) >>$seqres.full 2>&1
34 $XFS_IO_PROG -f -c "pwrite -S 0x72 0 $blksz" $DONOR1 >> $seqres.full
37 -c "falloc -k $((blksz*2)) $blksz" \
38 -c "pwrite -S 0x57 $((blksz*16)) 8192" \
41 -c "reflink $DONOR1 0 $((blksz*17)) $blksz" \
42 $TARGET >> $seqres.full
44 od -tx1 -Ad -c $TARGET >> $seqres.full
45 md5sum $DONOR1 | _filter_scratch
46 md5sum $TARGET | _filter_scratch
50 od -tx1 -Ad -c $TARGET >> $seqres.full
51 md5sum $DONOR1 | _filter_scratch
52 md5sum $TARGET | _filter_scratch