• Kevin Wolf's avatar
    block: Fix backing file child when modifying graph · 80a1e130
    Kevin Wolf authored
    
    
    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: default avatarKevin Wolf <kwolf@redhat.com>
    Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
    80a1e130