btrfs-progs: tests: check: detect bad extent item generation

The new image has a bad data extent item generation:

        item 0 key (13631488 EXTENT_ITEM 4096) itemoff 16230 itemsize 53
                refs 1 gen 16384 flags DATA
                extent data backref root FS_TREE objectid 257 offset 0 count 1

Just like what older `btrfs check --init-extent-tree` could cause.

Reviewed-by: Su Yue <Damenly_Su@gmx.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
master
Qu Wenruo 2019-12-31 15:12:20 +08:00 committed by David Sterba
parent b3621da146
commit d3f7315b3c
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#!/bin/bash
#
# Due to a bug in --init-extent-tree option, we may create bad generation
# number for data extents.
#
# This test case will ensure btrfs check can at least detect such problem,
# just like kernel tree-checker.
source "$TEST_TOP/common"
check_prereq btrfs
check_image() {
run_mustfail \
"btrfs check failed to detect invalid extent item generation" \
"$TOP/btrfs" check "$1"
}
check_all_images