On 9/5/23 12:01, Fiona Ebner wrote:
Can we assume block_job_remove_all_bdrv() to always hold the job's
AioContext?
I think so, see job_unref_locked(), job_prepare_locked() and
job_finalize_single_locked(). These call the callbacks that ultimately
get to block_job_remove_all_bdrv().
And if yes, can we just tell bdrv_graph_wrlock() that it
needs to release that before polling to fix the deadlock?
No, but I think it should be released and re-acquired in
block_job_remove_all_bdrv() itself.
mirror_exit_common() however holds _two_ AioContext locks at the time it
calls block_job_remove_all_bdrv(), qemu_get_aio_context() has to be
released and reacquired in mirror_exit_common() itself.
Paolo