[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 1/2] block: Fix dst total_sectors after copy offload
From: |
Fam Zheng |
Subject: |
[Qemu-block] [PATCH 1/2] block: Fix dst total_sectors after copy offloading |
Date: |
Wed, 4 Jul 2018 14:13:19 +0800 |
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 <address@hidden>
Signed-off-by: Fam Zheng <address@hidden>
---
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