• M
    block: Only the main loop can change AioContexts · 43eaaaef
    Max Reitz 提交于
    bdrv_set_aio_context_ignore() can only work in the main loop:
    bdrv_drained_begin() only works in the main loop and the node's (old)
    AioContext; and bdrv_drained_end() really only works in the main loop
    and the node's (new) AioContext (contrary to its current comment, which
    is just wrong).
    
    Consequentially, bdrv_set_aio_context_ignore() must be called from the
    main loop.  Luckily, assuming that we can make block graph changes only
    from the main loop as well, all its callers do that already.
    
    Note that changing a node's context in a sense is an operation that
    changes the block graph, so it actually makes sense to require this
    function to be called from the main loop.
    
    Also, fix bdrv_drained_end()'s description.  You can only use it from
    the main loop or the node's AioContext, and in the latter case, the
    whole subtree must be in the same context.
    
    Fixes: e037c09cSigned-off-by: NMax Reitz <mreitz@redhat.com>
    Message-id: 20190722133054.21781-3-mreitz@redhat.com
    Signed-off-by: NMax Reitz <mreitz@redhat.com>
    43eaaaef
block.c 197.9 KB