When bdrv_set_aio_context_ignore() is called in the main loop to change the AioContext onto the IO thread, the bdrv_drain_invoke_entry() never gets to run and the IO thread hangs at co_schedule_bh_cb().
This is because the AioContext is occupied by the main thread after being attached to the IO thread, and the main thread poll in bdrv_drained_end() waiting for the IO request to be drained, but the IO thread cannot acquire the AioContext, which leads to deadlock. Zhiyong Ye (1): block: Do not poll in bdrv_set_aio_context_ignore() when acquiring new_context block.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.11.0