From 80a1e130917e0745625129553c943743eb663727 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 17 Jun 2015 15:52:09 +0200 Subject: 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 Reviewed-by: Max Reitz --- include/block/block_int.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/block/block_int.h b/include/block/block_int.h index ec244b5d06..14ad4c334b 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -379,6 +379,7 @@ struct BlockDriverState { char exact_filename[PATH_MAX]; BlockDriverState *backing_hd; + BdrvChild *backing_child; BlockDriverState *file; NotifierList close_notifiers; -- cgit v1.2.3