2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Filipe Manana. All Rights Reserved.
5 # FS QA Test No. btrfs/025
7 # Test for an issue in btrfs send where it sent clone operations to user
8 # space with a range (offset + length) that was not aligned with the block
9 # size. This caused the btrfs receive command to send such clone operations
10 # to the ioctl clone API, which would return -EINVAL errors to btrfs receive,
11 # causing the receive command to abort immediately.
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
31 # real QA test starts here
38 _scratch_mkfs >/dev/null 2>&1
41 run_check $XFS_IO_PROG -f -c "truncate 819200" $SCRATCH_MNT/foo
42 _run_btrfs_util_prog filesystem sync $SCRATCH_MNT
44 run_check $XFS_IO_PROG -c "falloc -k 819200 667648" $SCRATCH_MNT/foo
45 _run_btrfs_util_prog filesystem sync $SCRATCH_MNT
47 run_check $XFS_IO_PROG -c "pwrite 1482752 2978" $SCRATCH_MNT/foo
48 _run_btrfs_util_prog filesystem sync $SCRATCH_MNT
50 _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT \
53 run_check $XFS_IO_PROG -c "truncate 883305" $SCRATCH_MNT/foo
54 _run_btrfs_util_prog filesystem sync $SCRATCH_MNT
56 _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT \
59 _run_btrfs_util_prog send -f $tmp/1.snap $SCRATCH_MNT/mysnap1
60 _run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 -f $tmp/2.snap \
61 $SCRATCH_MNT/mysnap2 2>&1
63 md5sum $SCRATCH_MNT/foo | _filter_scratch
64 md5sum $SCRATCH_MNT/mysnap1/foo | _filter_scratch
65 md5sum $SCRATCH_MNT/mysnap2/foo | _filter_scratch
68 _check_btrfs_filesystem $SCRATCH_DEV
69 _scratch_mkfs >/dev/null 2>&1
72 _run_btrfs_util_prog receive -f $tmp/1.snap $SCRATCH_MNT
73 md5sum $SCRATCH_MNT/mysnap1/foo | _filter_scratch
75 _run_btrfs_util_prog receive -f $tmp/2.snap $SCRATCH_MNT
76 md5sum $SCRATCH_MNT/mysnap2/foo | _filter_scratch
79 _check_btrfs_filesystem $SCRATCH_DEV