On Wed, Jun 29, 2022 at 10:15:35AM -0400, Emanuele Giuseppe Esposito wrote: > Change the job_{lock/unlock} and macros to use job_mutex. > > Now that they are not nop anymore, remove the aiocontext > to avoid deadlocks. > > Therefore: > - when possible, remove completely the aiocontext lock/unlock pair > - if it is used by some other function too, reduce the locking > section as much as possible, leaving the job API outside. > > There is only one JobDriver callback, ->free() that assumes that > the aiocontext lock is held (because it calls bdrv_unref), so for > now keep that under aiocontext lock. This discussion shouldn't hold up the patch series, it's a separate issue: Why does bdrv_unref() need the AioContext lock? The reference count itself is protected by the BQL (bdrv_ref() is GS too). I/O requests should be using fine-grained locks now, so I'm not sure if we still need to hold the AioContext lock to drain them? Reviewed-by: Stefan Hajnoczi