From f3d56eb296778e4697a812cca3c1825263f1eced Mon Sep 17 00:00:00 2001 From: Kevin Wolf <kwolf@redhat.com> Date: Fri, 18 Jun 2010 15:22:34 -0300 Subject: [PATCH 16/18] qcow2: Return real error code in load_refcount_block RH-Author: Kevin Wolf <kwolf@redhat.com> Message-id: <patch-9991-clone-for-rhel55-rhel55> Patchwork-id: 10049 O-Subject: [RHEL-5.6 KVM PATCH 16/16] qcow2: Return real error code in load_refcount_block Bugzilla: 612508 RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com> RH-Acked-by: Juan Quintela <quintela@redhat.com> RH-Acked-by: Christoph Hellwig <chellwig@redhat.com> RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> Bugzilla: 605701 Upstream commit: e14e8ba5d059687bf276077da997c3ecfb5eab86 This fixes load_refcount_block which always returned -EIO for bdrv_pwrite failure. Signed-off-by: Kevin Wolf <kwolf@redhat.com> --- qemu/block-qcow2.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- qemu/block-qcow2.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qemu/block-qcow2.c b/qemu/block-qcow2.c index 8df2f29..5306a50 100644 --- a/qemu/block-qcow2.c +++ b/qemu/block-qcow2.c @@ -2590,8 +2590,10 @@ static int load_refcount_block(BlockDriverState *bs, int ret; ret = bdrv_pread(s->hd, refcount_block_offset, s->refcount_block_cache, s->cluster_size); - if (ret != s->cluster_size) - return -EIO; + if (ret < 0) { + return ret; + } + s->refcount_block_cache_offset = refcount_block_offset; return 0; } -- 1.7.0.3