btrfs: test incremental send after removing a directory and all its files
[xfstests-dev.git] / tests / btrfs / 154
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 Synology.  All Rights Reserved.
4 #
5 # FS QA Test No. 154
6 #
7 # Test if btrfs rename handle dir item collision correctly
8 # Without patch fix, rename will fail with EOVERFLOW, and filesystem
9 # is forced readonly.
10 #
11 # This bug is going to be fixed by a patch for kernel titled
12 # "btrfs: correctly calculate item size used when item key collision happens"
13 #
14 seq=`basename $0`
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
17
18 here=`pwd`
19 tmp=/tmp/$$
20 status=1        # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
22
23 _cleanup()
24 {
25         cd /
26         rm -f $tmp.*
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32
33 # real QA test starts here
34
35 _supported_fs btrfs
36 _require_scratch
37 _require_command $PYTHON2_PROG python2
38
39 rm -f $seqres.full
40
41 # Currently in btrfs the node/leaf size can not be smaller than the page
42 # size (but it can be greater than the page size). So use the largest
43 # supported node/leaf size (64Kb) so that the test can run on any platform
44 # that Linux supports.
45 _scratch_mkfs "--nodesize 65536" >>$seqres.full 2>&1
46 _scratch_mount
47
48 #
49 # In the following for loop, we'll create a leaf fully occupied by
50 # only one dir item with many forged collision names in it.
51 #
52 # leaf 22544384 items 1 free space 0 generation 6 owner FS_TREE
53 # leaf 22544384 flags 0x1(WRITTEN) backref revision 1
54 # fs uuid 9064ba52-3d2c-4840-8e26-35db08fa17d7
55 # chunk uuid 9ba39317-3159-46c9-a75a-965ab1e94267
56 #    item 0 key (256 DIR_ITEM 3737737011) itemoff 25 itemsize 65410
57 #    ...
58 #
59
60 $PYTHON2_PROG $here/src/btrfs_crc32c_forged_name.py -d $SCRATCH_MNT -c 310
61 echo "Silence is golden"
62
63 # success, all done
64 status=0; exit