OSDN Git Service

block: Fix backing file child when modifying graph
authorKevin Wolf <kwolf@redhat.com>
Wed, 17 Jun 2015 13:52:09 +0000 (15:52 +0200)
committerKevin Wolf <kwolf@redhat.com>
Tue, 14 Jul 2015 15:15:23 +0000 (17:15 +0200)
commit80a1e130917e0745625129553c943743eb663727
tree7e77e913c49a4ba11a3ad67b0e8dffaa9e387de8
parent9a7dedbc43c7c400663d2876a8ccb6d942a1429a
block: Fix backing file child when modifying graph

This patch moves bdrv_attach_child() from the individual places that add
a backing file to a BDS to bdrv_set_backing_hd(), which is called by all
of them. It also adds bdrv_detach_child() there.

For normal operation (starting with one backing file chain and not
changing it until the topmost image is closed) and live snapshots, this
constitutes no change in behaviour.

For all other cases, this is a fix for the bug that the old backing file
was still referenced as a child, and the new one wasn't referenced.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
block.c
include/block/block_int.h