From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXnL0-0003fF-3f for qemu-devel@nongnu.org; Thu, 11 Aug 2016 06:35:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXnKx-0002N7-Ls for qemu-devel@nongnu.org; Thu, 11 Aug 2016 06:35:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXnKx-0002Mg-Fg for qemu-devel@nongnu.org; Thu, 11 Aug 2016 06:35:43 -0400 From: Stefan Hajnoczi Date: Thu, 11 Aug 2016 11:35:39 +0100 Message-Id: <1470911739-29593-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1470911739-29593-1-git-send-email-stefanha@redhat.com> References: <1470911739-29593-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 1/1] linux-aio: Handle io_submit() failure gracefully List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Kevin Wolf , Stefan Hajnoczi From: Kevin Wolf 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 Message-id: 1470741619-23231-1-git-send-email-kwolf@redhat.com Signed-off-by: Stefan Hajnoczi --- block/linux-aio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/block/linux-aio.c b/block/linux-aio.c index de3548f..e906abe 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; -- 2.7.4