Commit 30c321f9 authored by Anton Kuchin's avatar Anton Kuchin Committed by Kevin Wolf
Browse files

block: remove bs from lists before closing



Close involves flush that can be performed asynchronously and bs
must be protected from being referenced before it is deleted.

Signed-off-by: default avatarAnton Kuchin <antonkuchin@yandex-team.ru>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent efb4f3b6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4082,14 +4082,14 @@ static void bdrv_delete(BlockDriverState *bs)
    assert(bdrv_op_blocker_is_empty(bs));
    assert(!bs->refcnt);

    bdrv_close(bs);

    /* remove from list, if necessary */
    if (bs->node_name[0] != '\0') {
        QTAILQ_REMOVE(&graph_bdrv_states, bs, node_list);
    }
    QTAILQ_REMOVE(&all_bdrv_states, bs, bs_list);

    bdrv_close(bs);

    g_free(bs);
}