On 05/09/2018 13:23, Sergio Lopez wrote: > diff --git a/block/linux-aio.c b/block/linux-aio.c > index 19eb922fdd..217ce60138 100644 > --- a/block/linux-aio.c > +++ b/block/linux-aio.c > @@ -234,9 +234,9 @@ static void qemu_laio_process_completions(LinuxAioState > *s) > > static void qemu_laio_process_completions_and_submit(LinuxAioState *s) > { > + aio_context_acquire(s->aio_context); > qemu_laio_process_completions(s); > > - aio_context_acquire(s->aio_context); > if (!s->io_q.plugged && !QSIMPLEQ_EMPTY(&s->io_q.pending)) { > ioq_submit(s); > } >
The patch is correct, but I think it's papering over the real issue; as Kevin pointed out recently, the sticking issue is calling aio_poll from other threads---which right now we're only doing in bdrv_set_aio_context and bdrv_drain_poll_top_level. As to the call in bdrv_drain(), Kevin has just posted the series to remove it. For the other one, I think we can replace it with AIO_WAIT_WHILE or BDRV_POLL_WHILE and do the aio_poll in the BlockDriverState's home iothread. That said, I have nothing against applying it since all it does is move a function call, that can be removed completely once the underlying root cause is fixed (the AioContext lock will disappear). Reviewed-by: Paolo Bonzini <pbonz...@redhat.com> Thanks, Paolo