• S
    block: use safe iteration over AioContext notifiers · e8a095da
    Stefan Hajnoczi 提交于
    It's possible that an AioContext notifier user was close to finishing
    when .detach_aio_context() or .attached_aio_context() is called.  In
    that case they may call bdrv_remove_aio_context_notifier() during the
    callback.
    
    Use safe iteration to avoid crashing when the notifier list is modified
    during iteration.  We must not only handle the case where the current
    aio notifier is removed during a callback but also the one where any
    other aio notifier is removed.
    
    The next patch adds an AioContext notifier for block jobs and they
    really could be terminating just as .detach_aio_context() is invoked.
    Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: NPaolo Bonzini <pbonzini@redhat.com>
    Reviewed-by: NFam Zheng <famz@redhat.com>
    Message-id: 1466096189-6477-6-git-send-email-stefanha@redhat.com
    e8a095da
block_int.h 29.6 KB