diff options
| author | Kevin Wolf <kwolf@redhat.com> | 2025-02-04 22:13:56 +0100 |
|---|---|---|
| committer | Kevin Wolf <kwolf@redhat.com> | 2025-02-06 14:26:51 +0100 |
| commit | 9b81361aedcc47905de5e91f68221de89c6f5467 (patch) | |
| tree | 6d76f9415351c5a98e64fa38d1f8611c88f82ff8 | |
| parent | c2a189976e211c9ff782538d5a5ed5e5cffeccd6 (diff) | |
| download | focaccia-qemu-9b81361aedcc47905de5e91f68221de89c6f5467.tar.gz focaccia-qemu-9b81361aedcc47905de5e91f68221de89c6f5467.zip | |
block: Don't attach inactive child to active node
An active node makes unrestricted use of its children and would possibly run into assertion failures when it operates on an inactive child node. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Fabiano Rosas <farosas@suse.de> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-ID: <20250204211407.381505-6-kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| -rw-r--r-- | block.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/block.c b/block.c index 9458c5e013..66a99e87c5 100644 --- a/block.c +++ b/block.c @@ -3183,6 +3183,11 @@ bdrv_attach_child_noperm(BlockDriverState *parent_bs, child_bs->node_name, child_name, parent_bs->node_name); return NULL; } + if (bdrv_is_inactive(child_bs) && !bdrv_is_inactive(parent_bs)) { + error_setg(errp, "Inactive '%s' can't be a %s child of active '%s'", + child_bs->node_name, child_name, parent_bs->node_name); + return NULL; + } bdrv_get_cumulative_perm(parent_bs, &perm, &shared_perm); bdrv_child_perm(parent_bs, child_bs, NULL, child_role, NULL, |