On 19/07/2016 13:18, Roman Penyaev wrote: >> > No need for this new field. You can just do nothing here and check >> > laiocb.ret == -EINPROGRESS here in laio_co_submit. > > I have thought but did not like it, because we depend on the value, > which kernel writes there.
(The kernel actually writes to ev->res). > If kernel by chance writes -EINPROGRESS > (whatever that means, bug in some ll driver?) we are screwed up. > But probably that is my paranoia. Understood. However, QEMU relies elsewhere on EINPROGRESS not being returned for file I/O, so I think it's safe. > Also, I hope (I do not know how to reproduce this, virtio_blk does not nest), > that we are allowed to nest (calling aio_poll() and all this machinery) from > co-routine. Hmm, good question. The nesting scenario originally happened exactly from a coroutine (commit_run), but I suspect that it cannot happen anymore since we've introduced block_job_defer_to_main_loop and bdrv_co_drain. In any case your patch wouldn't change that. Paolo > Are we? We can lead to deep nesting inside the following sequence: > ioq_submit() -> complete() -> aio_poll() -> ioq_submit() -> complete() ... > but that can happen of course even without this patch. I would say this > nesting > is a clumsy stuff. Paolo