aboutsummaryrefslogtreecommitdiff
path: root/qemu-io-cmds.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-09-04 19:00:25 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-09-06 15:25:09 +0200
commitd663640c04f2aab810915c556390211d75457704 (patch)
treee255e24307c7889d516fc74c0416b6084c4d90f8 /qemu-io-cmds.c
parent4f5786376e41980e78af45a123c56ebdc5295099 (diff)
downloadqemu-d663640c04f2aab810915c556390211d75457704.zip
qemu-d663640c04f2aab810915c556390211d75457704.tar.gz
qemu-d663640c04f2aab810915c556390211d75457704.tar.bz2
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 <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'qemu-io-cmds.c')
-rw-r--r--qemu-io-cmds.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index f91b6c4..8565d49 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -1830,6 +1830,10 @@ static int alloc_f(BlockDriverState *bs, int argc, char **argv)
sector_num = offset >> 9;
while (remaining) {
ret = bdrv_is_allocated(bs, sector_num, remaining, &num);
+ if (ret < 0) {
+ printf("is_allocated failed: %s\n", strerror(-ret));
+ return 0;
+ }
sector_num += num;
remaining -= num;
if (ret) {