Skip to contentSkip to conversation

gluster: Abort on AIO completion failure

PATCH In review Bharata B Rao 2 participants 3 messages Aug 27, 2013 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gluster: Abort on AIO completion failure

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.

---
 block/gluster.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
block/gluster.c +2 -13
index 46f36f8..942154a 100644
@@ -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");
+        abort();
     }
 }
 
Signature · 1 line
1.7.11.7
#1 lore raw

Il 27/08/2013 07:53, Bharata B Rao ha scritto:

Quoted 24 lines

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.

---
 block/gluster.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
block/gluster.c +0 -4
index 46f36f8..942154a 100644
@@ -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");

block/gluster.c static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg) · line 431

Quoted 10 lines
block/gluster.c +1 -9
-
-        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");

Still, considering everyone can be wrong, adding the errno here is probably not a bad idea. :)

Paolo

Quoted 5 lines
block/gluster.c +1 -0
+        abort();
     }
 }
 
#2 lore raw
Quoted 18 lines · Paolo Bonzini
Quoted 18 lines
block/gluster.c +0 -9
index 46f36f8..942154a 100644
@@ -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]);
Quoted 8 lines

block/gluster.c static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret, void *arg) · line 431

Quoted 5 lines
block/gluster.c +1 -4
-        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");

Still, considering everyone can be wrong, adding the errno here is probably not a bad idea. :)

Sent v1 with errno added.

Regards,
Bharata.