• P
    block: only call aio_poll on the current thread's AioContext · c9d1a561
    Paolo Bonzini 提交于
    aio_poll is not thread safe; for example bdrv_drain can hang if
    the last in-flight I/O operation is completed in the I/O thread after
    the main thread has checked bs->in_flight.
    
    The bug remains latent as long as all of it is called within
    aio_context_acquire/aio_context_release, but this will change soon.
    
    To fix this, if bdrv_drain is called from outside the I/O thread,
    signal the main AioContext through a dummy bottom half.  The event
    loop then only runs in the I/O thread.
    Reviewed-by: NFam Zheng <famz@redhat.com>
    Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
    Message-Id: <1477565348-5458-18-git-send-email-pbonzini@redhat.com>
    Signed-off-by: NFam Zheng <famz@redhat.com>
    c9d1a561
nfs.c 17.6 KB