Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 340e01248478ba8b78a6d4d1809b1eff > files > 664

kvm-83-270.el5_11.src.rpm

From 5a1495ed411950a549273de248d0f1eee3e0fb1f 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: <1276874554-9820-17-git-send-email-kwolf@redhat.com>
Patchwork-id: 9991
O-Subject: [RHEL-5.6 KVM PATCH 16/16] qcow2: Return real error code in
	load_refcount_block
Bugzilla: 605701
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Eduardo Habkost <ehabkost@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