summary refs log tree commit diff stats
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-02-09 12:51:18 +0100
committerKevin Wolf <kwolf@redhat.com>2017-02-28 20:40:37 +0100
commit3e44c8e08a4b84ec1f4f1eb249d33005bb9cf572 (patch)
tree575c8145dc369d02b00e7626c71fa8a6d7014da1 /block.c
parentdb95dbba3b7b09cd11ffaf3a8453c2500e807f80 (diff)
downloadfocaccia-qemu-3e44c8e08a4b84ec1f4f1eb249d33005bb9cf572.tar.gz
focaccia-qemu-3e44c8e08a4b84ec1f4f1eb249d33005bb9cf572.zip
block: Allow backing file links in change_parent_backing_link()
Now that the backing file child role implements .attach/.detach
callbacks, nothing prevents us from modifying the graph even if that
involves changing backing file links.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Acked-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/block.c b/block.c
index 698a5c7e0b..79d9ad0ad6 100644
--- a/block.c
+++ b/block.c
@@ -2882,9 +2882,9 @@ static void change_parent_backing_link(BlockDriverState *from,
             continue;
         }
         if (c->role == &child_backing) {
-            /* @from is generally not allowed to be a backing file, except for
-             * when @to is the overlay. In that case, @from may not be replaced
-             * by @to as @to's backing node. */
+            /* If @from is a backing file of @to, ignore the child to avoid
+             * creating a loop. We only want to change the pointer of other
+             * parents. */
             QLIST_FOREACH(to_c, &to->children, next) {
                 if (to_c == c) {
                     break;
@@ -2895,7 +2895,6 @@ static void change_parent_backing_link(BlockDriverState *from,
             }
         }
 
-        assert(c->role != &child_backing);
         bdrv_ref(to);
         /* FIXME Are we sure that bdrv_replace_child() can't run into
          * &error_abort because of permissions? */