aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-08-09 13:20:19 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2016-08-11 09:42:35 +0100
commit44713c9e8547f0ff41e3e257f0dd5c17bb497225 (patch)
tree7c5a9bf11041872e2051b821439dbd57b1f532c1 /block
parentd08306dc42ea599ffcf8aad056fa9c23acfbe230 (diff)
linux-aio: Handle io_submit() failure gracefully
It is generally not expected that io_submit() fails other than with -EAGAIN, but corner cases like SELinux refusing I/O when permissions are revoked are still possible. In this case, we shouldn't abort, but just return an I/O error for the request. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-id: 1470741619-23231-1-git-send-email-kwolf@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/linux-aio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/block/linux-aio.c b/block/linux-aio.c
index de3548f2ab..e906abebb3 100644
--- a/block/linux-aio.c
+++ b/block/linux-aio.c
@@ -221,7 +221,13 @@ static void ioq_submit(LinuxAioState *s)
break;
}
if (ret < 0) {
- abort();
+ /* Fail the first request, retry the rest */
+ aiocb = QSIMPLEQ_FIRST(&s->io_q.pending);
+ QSIMPLEQ_REMOVE_HEAD(&s->io_q.pending, next);
+ s->io_q.in_queue--;
+ aiocb->ret = ret;
+ qemu_laio_process_completion(aiocb);
+ continue;
}
s->io_q.in_flight += ret;