btrfs: Introduce mount time chunk <-> dev extent mapping check
This patch will introduce chunk <-> dev extent mapping check, to protect us against invalid dev extents or chunks. Since chunk mapping is the fundamental infrastructure of btrfs, extra check at mount time could prevent a lot of unexpected behavior (BUG_ON). Reported-by: Xu Wen <wen.xu@gatech.edu> Link: https://bugzilla.kernel.org/show_bug.cgi?id=200403 Link: https://bugzilla.kernel.org/show_bug.cgi?id=200407 Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
@@ -3030,6 +3030,13 @@ retry_root_backup:
|
||||
fs_info->generation = generation;
|
||||
fs_info->last_trans_committed = generation;
|
||||
|
||||
ret = btrfs_verify_dev_extents(fs_info);
|
||||
if (ret) {
|
||||
btrfs_err(fs_info,
|
||||
"failed to verify dev extents against chunks: %d",
|
||||
ret);
|
||||
goto fail_block_groups;
|
||||
}
|
||||
ret = btrfs_recover_balance(fs_info);
|
||||
if (ret) {
|
||||
btrfs_err(fs_info, "failed to recover balance: %d", ret);
|
||||
|
Reference in New Issue
Block a user