From d663640c04f2aab810915c556390211d75457704 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 4 Sep 2013 19:00:25 +0200 Subject: block: expect errors from bdrv_co_is_allocated Some bdrv_is_allocated callers do not expect errors, but the fallback in qcow2.c might make other callers trip on assertion failures or infinite loops. Fix the callers to always look for errors. Cc: qemu-stable@nongnu.org Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi --- block/qcow2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'block/qcow2.c') diff --git a/block/qcow2.c b/block/qcow2.c index 4d7bd78..cf03a14 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -696,13 +696,11 @@ static int coroutine_fn qcow2_co_is_allocated(BlockDriverState *bs, int ret; *pnum = nb_sectors; - /* FIXME We can get errors here, but the bdrv_co_is_allocated interface - * can't pass them on today */ qemu_co_mutex_lock(&s->lock); ret = qcow2_get_cluster_offset(bs, sector_num << 9, pnum, &cluster_offset); qemu_co_mutex_unlock(&s->lock); if (ret < 0) { - *pnum = 0; + return ret; } return (cluster_offset != 0) || (ret == QCOW2_CLUSTER_ZERO); -- cgit v1.1