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
32 _require_scratch_reflink
33 _require_xfs_io_command "falloc"
37 # Fill disk with a well known pattern so that stale data exposure becomes much
39 $XFS_IO_PROG -c "pwrite -S 0x58 -b 1m 0 300m" $SCRATCH_DEV >> $seqres.full
40 _scratch_mkfs_sized $((300 * 1048576)) >>$seqres.full 2>&1
47 $XFS_IO_PROG -f -c "pwrite -S 0x72 0 $blksz" $DONOR1 >> $seqres.full
50 -c "falloc -k $((blksz*2)) $blksz" \
51 -c "pwrite -S 0x57 $((blksz*16)) 8192" \
54 -c "reflink $DONOR1 0 $((blksz*17)) $blksz" \
55 $TARGET >> $seqres.full
57 od -tx1 -Ad -c $TARGET >> $seqres.full
58 md5sum $DONOR1 | _filter_scratch
59 md5sum $TARGET | _filter_scratch
63 od -tx1 -Ad -c $TARGET >> $seqres.full
64 md5sum $DONOR1 | _filter_scratch
65 md5sum $TARGET | _filter_scratch