From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYDQv-0001sl-Rm for qemu-devel@nongnu.org; Fri, 12 Aug 2016 10:27:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bYDQr-00008H-J1 for qemu-devel@nongnu.org; Fri, 12 Aug 2016 10:27:36 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52166 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bYDQr-00007q-CX for qemu-devel@nongnu.org; Fri, 12 Aug 2016 10:27:33 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u7C7Y0E2095819 for ; Fri, 12 Aug 2016 03:38:46 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 24rty4h2b9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 12 Aug 2016 03:38:46 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Aug 2016 08:38:45 +0100 References: <1470741619-23231-1-git-send-email-kwolf@redhat.com> From: Christian Borntraeger Date: Fri, 12 Aug 2016 09:38:42 +0200 MIME-Version: 1.0 In-Reply-To: <1470741619-23231-1-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Message-Id: Subject: Re: [Qemu-devel] [PATCH] linux-aio: Handle io_submit() failure gracefully List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, Bjoern Walk , Boris Fiuczynski On 08/09/2016 01:20 PM, Kevin Wolf wrote: > 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 Yes, we have seen this as well when having a disk accessed by two different guests and quickly starting/stopping. AFAIK Bjoern or Boris are looking into some libvirt fixes to prevent that race from being triggered by libvirt, but having QEMU to not crash is certainly useful on its own. Christian > --- > 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; >