Skip to content

Commit 4acdcb5

Browse files
committed
btrfs-progs: add a test case for unknown keys in subvolume trees
The image has the following corrupted key in fs tree: item 4 key (257 INODE_ITEM 0) itemoff 15879 itemsize 160 generation 9 transid 9 size 0 nbytes 0 block group 0 mode 100644 links 1 uid 0 gid 0 rdev 0 sequence 1 flags 0x0(none) item 5 key (257 UNKNOWN.8 256) itemoff 15879 itemsize 0 <<< item 6 key (257 INODE_REF 256) itemoff 15863 itemsize 16 index 2 namelen 6 name: foobar This is inspired by a real world memory bitflip, which lead to a bitflip from 12 to 8, causing the above unknown key type in a subvolume. Although we will need to properly enhance btrfs-check to handle such case better, let's start from detecting and report such unknown keys as an error. The image is created by inserting an empty item with above unknown key type. Signed-off-by: Qu Wenruo <wqu@suse.com>
1 parent 4f3fb9e commit 4acdcb5

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
#
3+
# Verify that check can report unknown key types in subvolume trees
4+
5+
source "$TEST_TOP/common" || exit
6+
7+
check_prereq btrfs
8+
9+
check_image() {
10+
run_mustfail "unknown keys in subvolume trees not reported as error" \
11+
"$TOP/btrfs" check "$1"
12+
}
13+
14+
check_all_images
Binary file not shown.

0 commit comments

Comments
 (0)