From: Peter Lieven Date: Thu, 12 Dec 2013 12:57:05 +0000 (+0100) Subject: block: expect get_block_status errors in bdrv_make_zero X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3d94ce60ae7ad7c31dc143fdd9da95c61b4e529e;p=qemu.git block: expect get_block_status errors in bdrv_make_zero during testing around with 4k LUNs a bad target implementation triggert an -EIO in iscsi_get_block_status, but it got never caught resulting in an infinite loop. CC: qemu-stable@nongnu.org Signed-off-by: Peter Lieven Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- diff --git a/block.c b/block.c index 13f001ad69..64e7d220c6 100644 --- a/block.c +++ b/block.c @@ -2421,6 +2421,11 @@ int bdrv_make_zero(BlockDriverState *bs, BdrvRequestFlags flags) nb_sectors = INT_MAX; } ret = bdrv_get_block_status(bs, sector_num, nb_sectors, &n); + if (ret < 0) { + error_report("error getting block status at sector %" PRId64 ": %s", + sector_num, strerror(-ret)); + return ret; + } if (ret & BDRV_BLOCK_ZERO) { sector_num += n; continue;