Skip to content

Commit 44713c9

Browse files
kevmwstefanhaRH
authored andcommitted
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>
1 parent d08306d commit 44713c9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

block/linux-aio.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,13 @@ static void ioq_submit(LinuxAioState *s)
221221
break;
222222
}
223223
if (ret < 0) {
224-
abort();
224+
/* Fail the first request, retry the rest */
225+
aiocb = QSIMPLEQ_FIRST(&s->io_q.pending);
226+
QSIMPLEQ_REMOVE_HEAD(&s->io_q.pending, next);
227+
s->io_q.in_queue--;
228+
aiocb->ret = ret;
229+
qemu_laio_process_completion(aiocb);
230+
continue;
225231
}
226232

227233
s->io_q.in_flight += ret;

0 commit comments

Comments
 (0)