Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 3160499aacb81f6735941eb4c372d87a > files > 517

kvm-83-164.el5_5.30.src.rpm

From 774b7f94ce211589b350b701fc5fc8ec5f29774e Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Fri, 18 Jun 2010 15:22:20 -0300
Subject: [PATCH 02/18] qcow2: Don't ignore immediate read/write failures

RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <patch-9977-clone-for-rhel55-rhel55>
Patchwork-id: 10051
O-Subject: [RHEL-5.6 KVM PATCH 02/16] qcow2: Don't ignore immediate read/write
	failures
Bugzilla: 612508
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: 171e3d6b9997c98a97d0c525867f7cd9b640cadd

Returning -EIO is far from optimal, but at least it's an error code.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 qemu/block-qcow2.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu/block-qcow2.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/qemu/block-qcow2.c b/qemu/block-qcow2.c
index 8c6ad8e..04cf7a5 100644
--- a/qemu/block-qcow2.c
+++ b/qemu/block-qcow2.c
@@ -1492,8 +1492,10 @@ fail:
         acb->hd_aiocb = bdrv_aio_read(s->hd,
                             (acb->cluster_offset >> 9) + index_in_cluster,
                             acb->buf, acb->n, qcow_aio_read_cb, acb);
-        if (acb->hd_aiocb == NULL)
+        if (acb->hd_aiocb == NULL) {
+            ret = -EIO;
             goto fail;
+        }
     }
 }
 
@@ -1598,8 +1600,10 @@ static void qcow_aio_write_cb(void *opaque, int ret)
                                    (acb->cluster_offset >> 9) + index_in_cluster,
                                    src_buf, acb->n,
                                    qcow_aio_write_cb, acb);
-    if (acb->hd_aiocb == NULL)
+    if (acb->hd_aiocb == NULL) {
+        ret = -EIO;
         goto fail;
+    }
 }
 
 static BlockDriverAIOCB *qcow_aio_write(BlockDriverState *bs,
-- 
1.7.0.3