Skip to content

Commit 16edae5

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 <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 2dcf838 commit 16edae5

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)