* [Qemu-devel] [PATCH] linux-aio: Handle io_submit() failure gracefully
@ 2016-08-09 11:20 Kevin Wolf
2016-08-10 9:32 ` Stefan Hajnoczi
2016-08-12 7:38 ` Christian Borntraeger
0 siblings, 2 replies; 3+ messages in thread
From: Kevin Wolf @ 2016-08-09 11:20 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, pbonzini, stefanha, qemu-devel
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>
---
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;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-aio: Handle io_submit() failure gracefully
2016-08-09 11:20 [Qemu-devel] [PATCH] linux-aio: Handle io_submit() failure gracefully Kevin Wolf
@ 2016-08-10 9:32 ` Stefan Hajnoczi
2016-08-12 7:38 ` Christian Borntraeger
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2016-08-10 9:32 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-block, pbonzini, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 562 bytes --]
On Tue, Aug 09, 2016 at 01:20:19PM +0200, 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 <kwolf@redhat.com>
> ---
> block/linux-aio.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-aio: Handle io_submit() failure gracefully
2016-08-09 11:20 [Qemu-devel] [PATCH] linux-aio: Handle io_submit() failure gracefully Kevin Wolf
2016-08-10 9:32 ` Stefan Hajnoczi
@ 2016-08-12 7:38 ` Christian Borntraeger
1 sibling, 0 replies; 3+ messages in thread
From: Christian Borntraeger @ 2016-08-12 7:38 UTC (permalink / raw)
To: Kevin Wolf, qemu-block
Cc: pbonzini, qemu-devel, stefanha, 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 <kwolf@redhat.com>
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;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-12 14:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-09 11:20 [Qemu-devel] [PATCH] linux-aio: Handle io_submit() failure gracefully Kevin Wolf
2016-08-10 9:32 ` Stefan Hajnoczi
2016-08-12 7:38 ` Christian Borntraeger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).