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 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # get standard environment, filters and checks
30 # real QA test starts here
33 _require_scratch_reflink
34 _require_xfs_io_command "falloc"
38 # Fill disk with a well known pattern so that stale data exposure becomes much
40 $XFS_IO_PROG -c "pwrite -S 0x58 -b 1m 0 300m" $SCRATCH_DEV >> $seqres.full
41 _scratch_mkfs_sized $((300 * 1048576)) >>$seqres.full 2>&1
48 $XFS_IO_PROG -f -c "pwrite -S 0x72 0 $blksz" $DONOR1 >> $seqres.full
51 -c "falloc -k $((blksz*2)) $blksz" \
52 -c "pwrite -S 0x57 $((blksz*16)) 8192" \
55 -c "reflink $DONOR1 0 $((blksz*17)) $blksz" \
56 $TARGET >> $seqres.full
58 od -tx1 -Ad -c $TARGET >> $seqres.full
59 md5sum $DONOR1 | _filter_scratch
60 md5sum $TARGET | _filter_scratch
64 od -tx1 -Ad -c $TARGET >> $seqres.full
65 md5sum $DONOR1 | _filter_scratch
66 md5sum $TARGET | _filter_scratch