Patchwork [v1] gluster: Abort on AIO completion failure

login
register
mail settings
Submitter Bharata B Rao
Date Aug. 27, 2013, 8:15 a.m.
Message ID <1377591341-2417-1-git-send-email-bharata@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/270061/
State New
Headers show

Comments

Bharata B Rao - Aug. 27, 2013, 8:15 a.m.
Currently if gluster AIO callback thread fails to notify the QEMU thread about
AIO completion, we try graceful recovery by marking the disk drive as
inaccessible. This error recovery code is race-prone as found by Asias and
Stefan. However as found out by Paolo, this kind of error is impossible and
hence simplify the code that handles this error recovery.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
Changes in v1: Print errno information.


 block/gluster.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
Stefan Hajnoczi - Aug. 29, 2013, 7:35 a.m.
On Tue, Aug 27, 2013 at 01:45:41PM +0530, Bharata B Rao wrote:
> Currently if gluster AIO callback thread fails to notify the QEMU thread about
> AIO completion, we try graceful recovery by marking the disk drive as
> inaccessible. This error recovery code is race-prone as found by Asias and
> Stefan. However as found out by Paolo, this kind of error is impossible and
> hence simplify the code that handles this error recovery.
> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> ---
> Changes in v1: Print errno information.
> 
> 
>  block/gluster.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Kevin Wolf - Aug. 29, 2013, 7:45 a.m.
Am 29.08.2013 um 09:35 hat Stefan Hajnoczi geschrieben:
> On Tue, Aug 27, 2013 at 01:45:41PM +0530, Bharata B Rao wrote:
> > Currently if gluster AIO callback thread fails to notify the QEMU thread about
> > AIO completion, we try graceful recovery by marking the disk drive as
> > inaccessible. This error recovery code is race-prone as found by Asias and
> > Stefan. However as found out by Paolo, this kind of error is impossible and
> > hence simplify the code that handles this error recovery.
> > 
> > Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
> > ---
> > Changes in v1: Print errno information.
> > 
> > 
> >  block/gluster.c | 15 ++-------------
> >  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Thanks, applied to the block branch. (Wouldn't have hurt though to
mention why this kind of error is impossible and what the race is.)

Kevin

Patch

diff --git a/block/gluster.c b/block/gluster.c
index 46f36f8..dbb03f4 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -427,20 +427,9 @@  static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg)
         /*
          * Gluster AIO callback thread failed to notify the waiting
          * QEMU thread about IO completion.
-         *
-         * Complete this IO request and make the disk inaccessible for
-         * subsequent reads and writes.
          */
-        error_report("Gluster failed to notify QEMU about IO completion");
-
-        qemu_mutex_lock_iothread(); /* We are in gluster thread context */
-        acb->common.cb(acb->common.opaque, -EIO);
-        qemu_aio_release(acb);
-        close(s->fds[GLUSTER_FD_READ]);
-        close(s->fds[GLUSTER_FD_WRITE]);
-        qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], NULL, NULL, NULL);
-        bs->drv = NULL; /* Make the disk inaccessible */
-        qemu_mutex_unlock_iothread();
+        error_report("Gluster AIO completion failed: %s", strerror(errno));
+        abort();
     }
 }