diff options
author | Josef Bacik <josef@toxicpanda.com> | 2021-12-15 15:40:05 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2022-03-14 13:13:48 +0100 |
commit | c2fa821cc9f9415f6c7fc2da920e833a78040ea7 (patch) | |
tree | 124b5dc4024c8ba5ea909cb5b658a6b93e3eee8f /fs/btrfs/tree-checker.c | |
parent | 63cd070decb15f540b15f2bc35ecad42dd9cf598 (diff) | |
download | linux-stable-c2fa821cc9f9415f6c7fc2da920e833a78040ea7.tar.gz linux-stable-c2fa821cc9f9415f6c7fc2da920e833a78040ea7.tar.bz2 linux-stable-c2fa821cc9f9415f6c7fc2da920e833a78040ea7.zip |
btrfs: tree-checker: don't fail on empty extent roots for extent tree v2
For extent tree v2 we can definitely have empty extent roots, so skip
this particular check if we have that set.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tree-checker.c')
-rw-r--r-- | fs/btrfs/tree-checker.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c index aae5697dde32..64c7d2a2bb3e 100644 --- a/fs/btrfs/tree-checker.c +++ b/fs/btrfs/tree-checker.c @@ -1648,7 +1648,6 @@ static int check_leaf(struct extent_buffer *leaf, bool check_item_data) /* These trees must never be empty */ if (unlikely(owner == BTRFS_ROOT_TREE_OBJECTID || owner == BTRFS_CHUNK_TREE_OBJECTID || - owner == BTRFS_EXTENT_TREE_OBJECTID || owner == BTRFS_DEV_TREE_OBJECTID || owner == BTRFS_FS_TREE_OBJECTID || owner == BTRFS_DATA_RELOC_TREE_OBJECTID)) { @@ -1657,12 +1656,25 @@ static int check_leaf(struct extent_buffer *leaf, bool check_item_data) owner); return -EUCLEAN; } + /* Unknown tree */ if (unlikely(owner == 0)) { generic_err(leaf, 0, "invalid owner, root 0 is not defined"); return -EUCLEAN; } + + /* EXTENT_TREE_V2 can have empty extent trees. */ + if (btrfs_fs_incompat(fs_info, EXTENT_TREE_V2)) + return 0; + + if (unlikely(owner == BTRFS_EXTENT_TREE_OBJECTID)) { + generic_err(leaf, 0, + "invalid root, root %llu must never be empty", + owner); + return -EUCLEAN; + } + return 0; } |