2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 Synology. All Rights Reserved.
7 # Test if btrfs rename handle dir item collision correctly
8 # Without patch fix, rename will fail with EOVERFLOW, and filesystem
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"
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
20 status=1 # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
29 # get standard environment, filters and checks
33 # real QA test starts here
37 _require_command $PYTHON2_PROG python2
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
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.
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
60 $PYTHON2_PROG $here/src/btrfs_crc32c_forged_name.py -d $SCRATCH_MNT -c 310
61 echo "Silence is golden"