Commit 6d06b0ad authored by David Sterba's avatar David Sterba

btrfs: tree-checker: add missing returns after data_ref alignment checks

There are sectorsize alignment checks that are reported but then
check_extent_data_ref continues. This was not intended, wrong alignment
is not a minor problem and we should return with error.

CC: stable@vger.kernel.org # 5.4+
Fixes: 0785a9aa ("btrfs: tree-checker: Add EXTENT_DATA_REF check")
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 0697d9a6
...@@ -1424,6 +1424,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf, ...@@ -1424,6 +1424,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf,
"invalid item size, have %u expect aligned to %zu for key type %u", "invalid item size, have %u expect aligned to %zu for key type %u",
btrfs_item_size_nr(leaf, slot), btrfs_item_size_nr(leaf, slot),
sizeof(*dref), key->type); sizeof(*dref), key->type);
return -EUCLEAN;
} }
if (!IS_ALIGNED(key->objectid, leaf->fs_info->sectorsize)) { if (!IS_ALIGNED(key->objectid, leaf->fs_info->sectorsize)) {
generic_err(leaf, slot, generic_err(leaf, slot,
...@@ -1452,6 +1453,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf, ...@@ -1452,6 +1453,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf,
extent_err(leaf, slot, extent_err(leaf, slot,
"invalid extent data backref offset, have %llu expect aligned to %u", "invalid extent data backref offset, have %llu expect aligned to %u",
offset, leaf->fs_info->sectorsize); offset, leaf->fs_info->sectorsize);
return -EUCLEAN;
} }
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment