Sophie

Sophie

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

kvm-83-270.el5_11.src.rpm

From ca59f83288dc4a1133d8ac3e46065ee474f41887 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Tue, 24 Nov 2009 19:43:07 -0200
Subject: [PATCH 06/11] virtio-blk: Stop VM on read errors

RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <1258367498-9527-2-git-send-email-kwolf@redhat.com>
Patchwork-id: 3722
O-Subject: [RHEL-5.5 KVM PATCH v2 1/2] virtio-blk: Stop VM on read errors
Bugzilla: 531827
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Gleb Natapov <gleb@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>

Bugzilla: 531827
Upstream status: Needs to be solved differently (changes semantics of werror)

The VM should not only be stopped on write errors but also on read errors as
they can confuse the guest as well (e.g. remounting the root file system
read-only during a host NFS outage when the disk image is on NFS).

Note that without this patch, the VM does not only keep running, but read
errors are completely ignored rather than sent to the guest!

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 qemu/hw/virtio-blk.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu/hw/virtio-blk.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/qemu/hw/virtio-blk.c b/qemu/hw/virtio-blk.c
index fa20972..995ca81 100644
--- a/qemu/hw/virtio-blk.c
+++ b/qemu/hw/virtio-blk.c
@@ -54,7 +54,7 @@ static void virtio_blk_req_complete(VirtIOBlockReq *req, int status)
     qemu_free(req);
 }
 
-static int virtio_blk_handle_write_error(VirtIOBlockReq *req, int error)
+static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error)
 {
     BlockInterfaceErrorAction action = drive_get_onerror(req->dev->bs);
     VirtIOBlock *s = req->dev;
@@ -99,8 +99,8 @@ static void virtio_blk_rw_complete(void *opaque, int ret)
                    len);
             offset += len;
         }
-    } else if (ret && (req->out->type & VIRTIO_BLK_T_OUT)) {
-        if (virtio_blk_handle_write_error(req, -ret))
+    } else if (ret) {
+        if (virtio_blk_handle_rw_error(req, -ret))
             return;
     }
 
-- 
1.6.3.rc4.29.g8146