From patchwork Tue Aug 9 11:20:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 9270915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 77E7660839 for ; Tue, 9 Aug 2016 11:21:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6924827E66 for ; Tue, 9 Aug 2016 11:21:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D9B42818B; Tue, 9 Aug 2016 11:21:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1A96527E66 for ; Tue, 9 Aug 2016 11:21:06 +0000 (UTC) Received: from localhost ([::1]:34809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bX55l-00019a-R3 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Aug 2016 07:21:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bX55V-00018N-Og for qemu-devel@nongnu.org; Tue, 09 Aug 2016 07:20:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bX55T-0003Fv-TZ for qemu-devel@nongnu.org; Tue, 09 Aug 2016 07:20:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bX55O-0003DC-5k; Tue, 09 Aug 2016 07:20:42 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B35053B3E7; Tue, 9 Aug 2016 11:20:41 +0000 (UTC) Received: from noname.str.redhat.com. (dhcp-192-197.str.redhat.com [10.33.192.197]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u79BKefW010890; Tue, 9 Aug 2016 07:20:40 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 9 Aug 2016 13:20:19 +0200 Message-Id: <1470741619-23231-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 09 Aug 2016 11:20:41 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] linux-aio: Handle io_submit() failure gracefully X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;