2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2017 SUSE Linux Products GmbH. All Rights Reserved.
5 # FS QA Test No. btrfs/144
7 # Test that an incremental send operation works correctly when an inode A is
8 # renamed, a new hard link added to it and some other inode B is renamed to
9 # the old name of inode A.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
22 rm -fr $send_files_dir
26 # get standard environment, filters and checks
30 # real QA test starts here
36 send_files_dir=$TEST_DIR/btrfs-test-$seq
39 rm -fr $send_files_dir
42 _scratch_mkfs >>$seqres.full 2>&1
49 # Filesystem looks like:
57 $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
58 $SCRATCH_MNT/mysnap1 > /dev/null
60 $BTRFS_UTIL_PROG send -f $send_files_dir/1.snap \
61 $SCRATCH_MNT/mysnap1 2>&1 1>/dev/null | _filter_scratch
63 mv $SCRATCH_MNT/f3 $SCRATCH_MNT/f4
64 ln $SCRATCH_MNT/f2 $SCRATCH_MNT/f5
65 mv $SCRATCH_MNT/f2 $SCRATCH_MNT/f3
66 mv $SCRATCH_MNT/f1 $SCRATCH_MNT/f2
68 # Filesystem now looks like:
78 $BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT \
79 $SCRATCH_MNT/mysnap2 > /dev/null
81 $BTRFS_UTIL_PROG send -p $SCRATCH_MNT/mysnap1 -f $send_files_dir/2.snap \
82 $SCRATCH_MNT/mysnap2 2>&1 1>/dev/null | _filter_scratch
84 $FSSUM_PROG -A -f -w $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
85 $FSSUM_PROG -A -f -w $send_files_dir/2.fssum \
86 -x $SCRATCH_MNT/mysnap2/mysnap1 $SCRATCH_MNT/mysnap2
88 # Now recreate the filesystem by receiving both send streams and verify we get
89 # the same content that the original filesystem had.
91 _scratch_mkfs >>$seqres.full 2>&1
94 $BTRFS_UTIL_PROG receive -f $send_files_dir/1.snap $SCRATCH_MNT > /dev/null
95 $BTRFS_UTIL_PROG receive -f $send_files_dir/2.snap $SCRATCH_MNT > /dev/null
96 $FSSUM_PROG -r $send_files_dir/1.fssum $SCRATCH_MNT/mysnap1
97 $FSSUM_PROG -r $send_files_dir/2.fssum $SCRATCH_MNT/mysnap2