mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
btrfs: handle unexpected free-space-tree key types
Replace the conditional assertions with proper error handling and transaction abort if we find an unexpected key type in the free space tree. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
@@ -259,7 +259,11 @@ int btrfs_convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
|
||||
nr++;
|
||||
path->slots[0]--;
|
||||
} else {
|
||||
ASSERT(0);
|
||||
btrfs_err(fs_info, "unexpected free space tree key type %u",
|
||||
found_key.type);
|
||||
ret = -EUCLEAN;
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,7 +409,11 @@ int btrfs_convert_free_space_to_extents(struct btrfs_trans_handle *trans,
|
||||
|
||||
nr++;
|
||||
} else {
|
||||
ASSERT(0);
|
||||
btrfs_err(fs_info, "unexpected free space tree key type %u",
|
||||
found_key.type);
|
||||
ret = -EUCLEAN;
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1518,7 +1526,11 @@ int btrfs_remove_block_group_free_space(struct btrfs_trans_handle *trans,
|
||||
nr++;
|
||||
path->slots[0]--;
|
||||
} else {
|
||||
ASSERT(0);
|
||||
btrfs_err(trans->fs_info, "unexpected free space tree key type %u",
|
||||
found_key.type);
|
||||
ret = -EUCLEAN;
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user