• Stefan Hajnoczi's avatar
    block: let commit blockjob run in BDS AioContext · 9e85cd5c
    Stefan Hajnoczi authored
    The commit block job must run in the BlockDriverState AioContext so that
    it works with dataplane.
    
    Acquire the AioContext in blockdev.c so starting the block job is safe.
    One detail here is that the bdrv_drain_all() must be moved inside the
    aio_context_acquire() region so requests cannot sneak in between the
    drain and acquire.
    
    The completion code in block/commit.c must perform backing chain
    manipulation and bdrv_reopen() from the main loop.  Use
    block_job_defer_to_main_loop() to achieve that.
    Signed-off-by: 's avatarStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: 's avatarMax Reitz <mreitz@redhat.com>
    Message-id: 1413889440-32577-11-git-send-email-stefanha@redhat.com
    9e85cd5c
blockdev.c 81.5 KB