Commit 9a665b2b authored by Peter Lieven's avatar Peter Lieven Committed by Kevin Wolf
Browse files

block: complete all IOs before .bdrv_truncate

bdrv_truncate() invalidates the bdrv_check_request() result for
in-flight requests, so there should better be none.

Signed-off-by: default avatarPeter Lieven <>
Reported-by: default avatarKevin Wolf <>
Reviewed-by: default avatarPaolo Bonzini <>
Signed-off-by: default avatarKevin Wolf <>
parent 02700315
......@@ -2427,6 +2427,10 @@ int bdrv_truncate(BlockDriverState *bs, int64_t offset)
return -EACCES;
if (bdrv_in_use(bs))
return -EBUSY;
/* There better not be any in-flight IOs when we truncate the device. */
ret = drv->bdrv_truncate(bs, offset);
if (ret == 0) {
ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
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