xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / btrfs / 040
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Filipe Manana.  All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/040
6 #
7 # Regression test for btrfs incremental send issue where an rmdir
8 # instruction was sent multiple times for the same target directory.
9 # The number of times depended on the number of hardlinks against
10 # the same inode inside the target directory. That inode must have
11 # had the highest number of all the inodes that were children of the
12 # directory. This made the btrfs receive command fail immediately once
13 # it received the second rmdir instruction.
14 #
15 # This issue is fixed by the following linux kernel btrfs patch:
16 #
17 #   Btrfs: send, don't send rmdir for same target multiple times
18 #
19 seq=`basename $0`
20 seqres=$RESULT_DIR/$seq
21 echo "QA output created by $seq"
22
23 tmp=`mktemp -d`
24 status=1        # failure is the default!
25 trap "_cleanup; exit \$status" 0 1 2 3 15
26
27 _cleanup()
28 {
29     rm -fr $tmp
30 }
31
32 # get standard environment, filters and checks
33 . ./common/rc
34 . ./common/filter
35
36 # real QA test starts here
37 _supported_fs btrfs
38 _supported_os Linux
39 _require_scratch
40 _require_fssum
41
42 rm -f $seqres.full
43
44 _scratch_mkfs >/dev/null 2>&1
45 _scratch_mount
46
47 mkdir -p $SCRATCH_MNT/a/b/c
48 echo 'hello world' > $SCRATCH_MNT/a/b/c/hel.txt
49 echo 'ola mundo' > $SCRATCH_MNT/a/b/c/foo.txt
50 ln $SCRATCH_MNT/a/b/c/foo.txt $SCRATCH_MNT/a/b/c/bar.txt
51 ln $SCRATCH_MNT/a/b/c/foo.txt $SCRATCH_MNT/a/b/baz.txt
52
53 # Filesystem looks like:
54 #
55 # .                        (ino 256)
56 # |-- a/                   (ino 257)
57 #     |-- b/               (ino 258)
58 #         |-- c/           (ino 259)
59 #         |   |-- hel.txt  (ino 260)
60 #         |   |-- foo.txt  (ino 261)
61 #         |   |-- bar.txt  (ino 261)
62 #         |
63 #         |-- baz.txt      (ino 261)
64
65 _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap1
66
67 rm -f $SCRATCH_MNT/a/b/c/foo.txt
68 rm -f $SCRATCH_MNT/a/b/c/bar.txt
69 rm -f $SCRATCH_MNT/a/b/c/hel.txt
70 rmdir $SCRATCH_MNT/a/b/c
71
72 # Filesystem now looks like:
73 #
74 # .                        (ino 256)
75 # |-- a/                   (ino 257)
76 #     |-- b/               (ino 258)
77 #         |-- baz.txt      (ino 261)
78
79 _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap2
80
81 run_check $FSSUM_PROG -A -f -w $tmp/1.fssum $SCRATCH_MNT/mysnap1
82 run_check $FSSUM_PROG -A -f -w $tmp/2.fssum -x $SCRATCH_MNT/mysnap2/mysnap1 \
83         $SCRATCH_MNT/mysnap2
84
85 _run_btrfs_util_prog send -f $tmp/1.snap $SCRATCH_MNT/mysnap1
86 _run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 -f $tmp/2.snap \
87         $SCRATCH_MNT/mysnap2
88
89 _scratch_unmount
90 _check_btrfs_filesystem $SCRATCH_DEV
91
92 _scratch_mkfs >/dev/null 2>&1
93 _scratch_mount
94
95 _run_btrfs_util_prog receive -f $tmp/1.snap $SCRATCH_MNT
96 run_check $FSSUM_PROG -r $tmp/1.fssum $SCRATCH_MNT/mysnap1 2>> $seqres.full
97
98 _run_btrfs_util_prog receive -f $tmp/2.snap $SCRATCH_MNT
99 run_check $FSSUM_PROG -r $tmp/2.fssum $SCRATCH_MNT/mysnap2 2>> $seqres.full
100
101 _scratch_unmount
102 _check_btrfs_filesystem $SCRATCH_DEV
103
104 status=0
105 exit