On 9/18/22 20:12, Emanuele Giuseppe Esposito wrote:
>>> --- a/qemu-img.c
>>> +++ b/qemu-img.c
>>> @@ -911,7 +911,6 @@ static void run_block_job(BlockJob *job, Error
>>> **errp)
>>> AioContext *aio_context = block_job_get_aio_context(job);
>>> int ret = 0;
>>> - aio_context_acquire(aio_context);
>>> job_lock();
>>> job_ref_locked(&job->job);
>>> do {
>> aio_poll() call here, doesn't require aio_context to be acquired?
> On the contrary I think, if you see in AIO_WAIT_WHILE we explicitly
> release it because we don't want to allow something else to run with the
> aiocontext acquired.
>
Still, in AIO_WAIT_WHILE() we release ctx_, but do aio_poll(qemu_get_aio_context(), true), so we poll in other context.
But here in qemu-img.c we drop aiocontext lock exactly for aio_context, which is an argument of aio_poll()..
It's the same, the acquire/release is done again in file descriptor callback or bottom halves (typically via aio_co_wake).
Paolo
--
Best regards,
Vladimir