btrfs: tree-checker: add missing returns after data_ref alignment checks
Subsystems (2)
David Sterba
maintainerPATCH 1/1 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 [email protected] # 5.4+
Fixes 0785a9aacf9d ("btrfs: tree-checker: Add EXTENT_DATA_REF check")
Signed-off-by David Sterba <[email protected]>
--- fs/btrfs/tree-checker.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/tree-checker.c +2 -0
@@ -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" ,btrfs_item_size_nr (leaf, slot), sizeof(*dref), key->type); +return -EUCLEAN ; }if (!IS_ALIGNED (key->objectid, leaf->fs_info->sectorsize)) { generic_err(leaf, slot,
@@ -1452,6 +1453,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf,extent_err (leaf, slot,"invalid extent data backref offset, have %llu expect aligned to %u" , offset, leaf->fs_info->sectorsize); +return -EUCLEAN ; } }return 0 ;
Signature · 1 line
2.25.0
Quoted 7 lines · David Sterba
There are sectorsize alignment checks that are reported but then
check_extent_data_refcontinues. This was not intended, wrong alignment is not a minor problem and we should return with error.CC [email protected] # 5.4+Fixes 0785a9aacf9d ("btrfs: tree-checker: Add EXTENT_DATA_REF check")Signed-off-by David Sterba <[email protected]>
Reviewed-by Qu Wenruo <[email protected]>
Thanks,
Qu
Quoted 25 lines
--- fs/btrfs/tree-checker.c | 2 ++ 1 file changed, 2 insertions(+)fs/btrfs/tree-checker.c +2
-0@@ -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" ,btrfs_item_size_nr (leaf, slot), sizeof(*dref), key->type); +return -EUCLEAN ; }if (!IS_ALIGNED (key->objectid, leaf->fs_info->sectorsize)) { generic_err(leaf, slot,@@ -1452,6 +1453,7 @@ static int check_extent_data_ref(struct extent_buffer *leaf,extent_err (leaf, slot,"invalid extent data backref offset, have %llu expect aligned to %u" , offset, leaf->fs_info->sectorsize); +return -EUCLEAN ; } }return 0 ;