diff mbox

virtio-blk: Respect werror option for flushes

Message ID 1287588232-8482-1-git-send-email-kwolf@redhat.com
State New
Headers show

Commit Message

Kevin Wolf Oct. 20, 2010, 3:23 p.m. UTC
The werror option now affects not only write requests, but also flush requests.
Previously, it was not possible to stop a VM on a failed flush.

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

Comments

Christoph Hellwig Oct. 21, 2010, 5:22 a.m. UTC | #1
On Wed, Oct 20, 2010 at 05:23:52PM +0200, Kevin Wolf wrote:
> The werror option now affects not only write requests, but also flush requests.
> Previously, it was not possible to stop a VM on a failed flush.

ACK
diff mbox

Patch

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index a1df26d..dbe2070 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -106,7 +106,13 @@  static void virtio_blk_flush_complete(void *opaque, int ret)
 {
     VirtIOBlockReq *req = opaque;
 
-    virtio_blk_req_complete(req, ret ? VIRTIO_BLK_S_IOERR : VIRTIO_BLK_S_OK);
+    if (ret) {
+        if (virtio_blk_handle_rw_error(req, -ret, 0)) {
+            return;
+        }
+    }
+
+    virtio_blk_req_complete(req, VIRTIO_BLK_S_OK);
 }
 
 static VirtIOBlockReq *virtio_blk_alloc_request(VirtIOBlock *s)