mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
db95dbba3b
commit
3e44c8e08a
7
block.c
7
block.c
|
@ -2882,9 +2882,9 @@ static void change_parent_backing_link(BlockDriverState *from,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (c->role == &child_backing) {
|
if (c->role == &child_backing) {
|
||||||
/* @from is generally not allowed to be a backing file, except for
|
/* If @from is a backing file of @to, ignore the child to avoid
|
||||||
* when @to is the overlay. In that case, @from may not be replaced
|
* creating a loop. We only want to change the pointer of other
|
||||||
* by @to as @to's backing node. */
|
* parents. */
|
||||||
QLIST_FOREACH(to_c, &to->children, next) {
|
QLIST_FOREACH(to_c, &to->children, next) {
|
||||||
if (to_c == c) {
|
if (to_c == c) {
|
||||||
break;
|
break;
|
||||||
|
@ -2895,7 +2895,6 @@ static void change_parent_backing_link(BlockDriverState *from,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(c->role != &child_backing);
|
|
||||||
bdrv_ref(to);
|
bdrv_ref(to);
|
||||||
/* FIXME Are we sure that bdrv_replace_child() can't run into
|
/* FIXME Are we sure that bdrv_replace_child() can't run into
|
||||||
* &error_abort because of permissions? */
|
* &error_abort because of permissions? */
|
||||||
|
|
Loading…
Reference in New Issue