Skip to content

Commit 8ea2218

Browse files
fdmananakdave
authored andcommitted
btrfs: don't silently ignore unexpected extent type when replaying log
If there's an unexpected (invalid) extent type, we just silently ignore it. This means a corruption or some bug somewhere, so instead return -EUCLEAN to the caller, making log replay fail, and print an error message with relevant information. Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 7f6ece7 commit 8ea2218

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/btrfs/tree-log.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,10 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
668668
extent_end = ALIGN(start + size,
669669
fs_info->sectorsize);
670670
} else {
671-
return 0;
671+
btrfs_err(fs_info,
672+
"unexpected extent type=%d root=%llu inode=%llu offset=%llu",
673+
found_type, btrfs_root_id(root), key->objectid, key->offset);
674+
return -EUCLEAN;
672675
}
673676

674677
inode = read_one_inode(root, key->objectid);

0 commit comments

Comments
 (0)