This was noticed by the new image fleecing tests case 222. The issue is apparent and we should just do the same right things as in bdrv_aligned_pwritev.
Reported-by: John Snow <js...@redhat.com> Signed-off-by: Fam Zheng <f...@redhat.com> --- block/io.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/io.c b/block/io.c index 1a2272fad3..8e02f4ab95 100644 --- a/block/io.c +++ b/block/io.c @@ -2945,6 +2945,10 @@ static int coroutine_fn bdrv_co_copy_range_internal(BdrvChild *src, dst, dst_offset, bytes, flags); } + if (ret == 0) { + int64_t end_sector = DIV_ROUND_UP(dst_offset + bytes, BDRV_SECTOR_SIZE); + dst->bs->total_sectors = MAX(dst->bs->total_sectors, end_sector); + } tracked_request_end(&src_req); tracked_request_end(&dst_req); bdrv_dec_in_flight(src->bs); -- 2.17.1