• P
    nbd: fix assert() on qemu-nbd stop · 23994a5f
    Pavel Butsykin 提交于
    From time to time qemu-nbd is crashing on the following assert:
        assert(state == TERMINATING);
        nbd_export_closed
        nbd_export_put
        main
    and the state at the moment of the crash is evaluated to TERMINATE.
    
    During shutdown process of the client the nbd_client_thread thread sends
    SIGTERM signal and the main thread calls the nbd_client_closed callback.
    If the SIGTERM callback will be executed after change the state to
    TERMINATING, then the state will once again be TERMINATE.
    
    To solve the issue, we must change the state to TERMINATE only if the state
    is RUNNING. In the other case we are shutting down already.
    Signed-off-by: NPavel Butsykin <pbutsykin@virtuozzo.com>
    Signed-off-by: NDenis V. Lunev <den@openvz.org>
    CC: Paolo Bonzini <pbonzini@redhat.com>
    Message-id: 1460629215-11567-1-git-send-email-den@openvz.org
    Signed-off-by: NMax Reitz <mreitz@redhat.com>
    23994a5f
qemu-nbd.c 28.8 KB