218e99
From ecfbec2139f06a75a03c510e24f265a869684edb Mon Sep 17 00:00:00 2001
218e99
From: Asias He <asias@redhat.com>
218e99
Date: Thu, 12 Sep 2013 07:39:35 +0200
218e99
Subject: [PATCH 15/29] gluster: Abort on AIO completion failure
218e99
218e99
RH-Author: Asias He <asias@redhat.com>
218e99
Message-id: <1378971575-22416-5-git-send-email-asias@redhat.com>
218e99
Patchwork-id: 54324
218e99
O-Subject: [RHEL7.0 qemu-kvm PATCH 4/4] gluster: Abort on AIO completion failure
218e99
Bugzilla: 1007226
218e99
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Fam Zheng <famz@redhat.com>
218e99
218e99
From: Bharata B Rao <bharata@linux.vnet.ibm.com>
218e99
218e99
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1004733
218e99
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6275752
218e99
218e99
Currently if gluster AIO callback thread fails to notify the QEMU thread about
218e99
AIO completion, we try graceful recovery by marking the disk drive as
218e99
inaccessible. This error recovery code is race-prone as found by Asias and
218e99
Stefan. However as found out by Paolo, this kind of error is impossible and
218e99
hence simplify the code that handles this error recovery.
218e99
218e99
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
218e99
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
218e99
(cherry picked from commit 9faa574f7d07109e2256c0b4b63e8711d650f2d8)
218e99
218e99
Conflicts:
218e99
	block/gluster.c
218e99
---
218e99
 block/gluster.c | 17 ++---------------
218e99
 1 file changed, 2 insertions(+), 15 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 block/gluster.c |   17 ++---------------
218e99
 1 files changed, 2 insertions(+), 15 deletions(-)
218e99
218e99
diff --git a/block/gluster.c b/block/gluster.c
218e99
index 7b10e9c..90a51ca 100644
218e99
--- a/block/gluster.c
218e99
+++ b/block/gluster.c
218e99
@@ -436,22 +436,9 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg)
218e99
         /*
218e99
          * Gluster AIO callback thread failed to notify the waiting
218e99
          * QEMU thread about IO completion.
218e99
-         *
218e99
-         * Complete this IO request and make the disk inaccessible for
218e99
-         * subsequent reads and writes.
218e99
          */
218e99
-        error_report("Gluster failed to notify QEMU about IO completion");
218e99
-
218e99
-        qemu_mutex_lock_iothread(); /* We are in gluster thread context */
218e99
-        acb->common.cb(acb->common.opaque, -EIO);
218e99
-        qemu_aio_release(acb);
218e99
-        s->qemu_aio_count--;
218e99
-        close(s->fds[GLUSTER_FD_READ]);
218e99
-        close(s->fds[GLUSTER_FD_WRITE]);
218e99
-        qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], NULL, NULL, NULL,
218e99
-            NULL);
218e99
-        bs->drv = NULL; /* Make the disk inaccessible */
218e99
-        qemu_mutex_unlock_iothread();
218e99
+        error_report("Gluster AIO completion failed: %s", strerror(errno));
218e99
+        abort();
218e99
     }
218e99
 }
218e99
 
218e99
-- 
218e99
1.7.1
218e99