diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-09-04 19:00:25 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-09-06 15:25:09 +0200 |
commit | d663640c04f2aab810915c556390211d75457704 (patch) | |
tree | e255e24307c7889d516fc74c0416b6084c4d90f8 /block/cow.c | |
parent | 4f5786376e41980e78af45a123c56ebdc5295099 (diff) | |
download | hqemu-d663640c04f2aab810915c556390211d75457704.zip hqemu-d663640c04f2aab810915c556390211d75457704.tar.gz |
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 'block/cow.c')
-rw-r--r-- | block/cow.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/block/cow.c b/block/cow.c index f4eca10..7450801 100644 --- a/block/cow.c +++ b/block/cow.c @@ -212,7 +212,11 @@ static int coroutine_fn cow_read(BlockDriverState *bs, int64_t sector_num, int ret, n; while (nb_sectors > 0) { - if (cow_co_is_allocated(bs, sector_num, nb_sectors, &n)) { + ret = cow_co_is_allocated(bs, sector_num, nb_sectors, &n); + if (ret < 0) { + return ret; + } + if (ret) { ret = bdrv_pread(bs->file, s->cow_sectors_offset + sector_num * 512, buf, n * 512); |