Commit 63ba17d3 authored by Vishvananda Ishaya's avatar Vishvananda Ishaya Committed by Stefan Hajnoczi
Browse files

block: Fix is_allocated_above with resized files

In an image chain, if the base image is smaller than the current
image, we need to make sure to use the current images count of
unallocated blocks once we get to the end of the base image. Without
this change the code will return 0 blocks when it gets to the end
of the base image and mirror_run will fail its assertion.
Signed-off-by: default avatarVishvananda Ishaya <>
Signed-off-by: default avatarStefan Hajnoczi <>
parent b93d6d24
......@@ -2800,7 +2800,9 @@ int coroutine_fn bdrv_co_is_allocated_above(BlockDriverState *top,
* [sector_num+x, nr_sectors] allocated.
if (n > pnum_inter) {
if (n > pnum_inter &&
(intermediate == top ||
sector_num + pnum_inter < intermediate->total_sectors)) {
n = pnum_inter;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment