]> git.proxmox.com Git - mirror_qemu.git/commit - block/block-backend.c
block: Fix reconfiguring graph with drained nodes
authorKevin Wolf <kwolf@redhat.com>
Tue, 17 May 2016 12:51:55 +0000 (14:51 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 25 May 2016 17:04:10 +0000 (19:04 +0200)
commit36fe13317bfc3414745528c6c08cea2904ca49ec
tree5c0d2dab6123311014f8b5e3bae6e9528859e21b
parent6820643fdbe0d4e2ab6a188dee4782c003a4bb68
block: Fix reconfiguring graph with drained nodes

When changing the BlockDriverState that a BdrvChild points to while the
node is currently drained, we must call the .drained_end() parent
callback. Conversely, when this means attaching a new node that is
already drained, we need to call .drained_begin().

bdrv_root_attach_child() takes now an opaque parameter, which is needed
because the callbacks must also be called if we're attaching a new child
to the BlockBackend when the root node is already drained, and they need
a way to identify the BlockBackend. Previously, child->opaque was set
too late and the callbacks would still see it as NULL.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
block.c
block/block-backend.c
include/block/block_int.h