2 # FS QA Test No. btrfs/039
4 # Regression test for a btrfs incremental send issue related to renaming of
5 # directories. If at the time of the initial send we have a directory that is
6 # a child of a directory with a higher inode number, and then later after the
7 # initial full send we rename both the child and parent directories, but
8 # without moving any of them, a subsequent incremental send would produce a
9 # rename instruction for the child directory that pointed to an invalid path.
10 # This made the btrfs receive operation fail.
12 # This issue is fixed by the following linux kernel btrfs patch:
14 # Btrfs: incremental send, fix invalid path after dir rename
16 #-----------------------------------------------------------------------
17 # Copyright (c) 2014 Filipe Manana. All Rights Reserved.
19 # This program is free software; you can redistribute it and/or
20 # modify it under the terms of the GNU General Public License as
21 # published by the Free Software Foundation.
23 # This program is distributed in the hope that it would be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 # GNU General Public License for more details.
28 # You should have received a copy of the GNU General Public License
29 # along with this program; if not, write the Free Software Foundation,
30 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #-----------------------------------------------------------------------
35 seqres=$RESULT_DIR/$seq
36 echo "QA output created by $seq"
39 status=1 # failure is the default!
40 trap "_cleanup; exit \$status" 0 1 2 3 15
47 # get standard environment, filters and checks
51 # real QA test starts here
60 _scratch_mkfs >/dev/null 2>&1
63 mkdir -p $SCRATCH_MNT/a/b
65 mkdir $SCRATCH_MNT/a/b/c
66 mv $SCRATCH_MNT/d $SCRATCH_MNT/a/b/c
68 mkdir -p $SCRATCH_MNT/a/b/f/g
69 mv $SCRATCH_MNT/e $SCRATCH_MNT/a/b/f/g
71 # Filesystem looks like:
83 _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
85 mv $SCRATCH_MNT/a/b/c $SCRATCH_MNT/a/b/x
86 mv $SCRATCH_MNT/a/b/x/d $SCRATCH_MNT/a/b/x/y
87 mv $SCRATCH_MNT/a/b/f $SCRATCH_MNT/a/b/w
88 mv $SCRATCH_MNT/a/b/w/g/e $SCRATCH_MNT/a/b/w/g/z
90 # Filesystem now looks like:
102 _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap2
104 run_check $FSSUM_PROG -A -f -w $tmp/1.fssum $SCRATCH_MNT/mysnap1
105 run_check $FSSUM_PROG -A -f -w $tmp/2.fssum -x $SCRATCH_MNT/mysnap2/mysnap1 \
108 _run_btrfs_util_prog send $SCRATCH_MNT/mysnap1 -f $tmp/1.snap
109 _run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 $SCRATCH_MNT/mysnap2 \
113 _check_btrfs_filesystem $SCRATCH_DEV
115 _scratch_mkfs >/dev/null 2>&1
118 _run_btrfs_util_prog receive $SCRATCH_MNT -f $tmp/1.snap
119 run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
121 _run_btrfs_util_prog receive $SCRATCH_MNT -f $tmp/2.snap
122 run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full
125 _check_btrfs_filesystem $SCRATCH_DEV