Skip to content

Commit cf4f03c

Browse files
lorddoskiaskdave
authored andcommitted
btrfs: improve error reporting in lookup_inline_extent_backref
When iterating the backrefs in an extent item if the ptr to the 'current' backref record goes beyond the extent item a warning is generated and -ENOENT is returned. However what's more appropriate to debug such cases would be to return EUCLEAN and also print identifying information about the performed search as well as the current content of the leaf containing the possibly corrupted extent item. Reviewed-by: Filipe Manana <[email protected]> Signed-off-by: Nikolay Borisov <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 0f07003 commit cf4f03c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

fs/btrfs/extent-tree.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,13 @@ int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,
895895
err = -ENOENT;
896896
while (1) {
897897
if (ptr >= end) {
898-
WARN_ON(ptr > end);
898+
if (ptr > end) {
899+
err = -EUCLEAN;
900+
btrfs_print_leaf(path->nodes[0]);
901+
btrfs_crit(fs_info,
902+
"overrun extent record at slot %d while looking for inline extent for root %llu owner %llu offset %llu parent %llu",
903+
path->slots[0], root_objectid, owner, offset, parent);
904+
}
899905
break;
900906
}
901907
iref = (struct btrfs_extent_inline_ref *)ptr;

0 commit comments

Comments
 (0)