aboutsummaryrefslogtreecommitdiff
path: root/hw/misc
diff options
context:
space:
mode:
authorHanna Reitz <hreitz@redhat.com>2021-11-15 15:54:05 +0100
committerHanna Reitz <hreitz@redhat.com>2021-11-16 09:43:46 +0100
commitb0a9f6fed3d80de610dcd04a7e66f9f30a04174f (patch)
tree817c18b0dbd9679f8d1df9eee70ce1b752660f95 /hw/misc
parent82b54cf51656bf3cd5ed1ac549e8a1085a0e3290 (diff)
downloadqemu-b0a9f6fed3d80de610dcd04a7e66f9f30a04174f.zip
qemu-b0a9f6fed3d80de610dcd04a7e66f9f30a04174f.tar.gz
qemu-b0a9f6fed3d80de610dcd04a7e66f9f30a04174f.tar.bz2
block: Let replace_child_noperm free children
In most of the block layer, especially when traversing down from other BlockDriverStates, we assume that BdrvChild.bs can never be NULL. When it becomes NULL, it is expected that the corresponding BdrvChild pointer also becomes NULL and the BdrvChild object is freed. Therefore, once bdrv_replace_child_noperm() sets the BdrvChild.bs pointer to NULL, it should also immediately set the corresponding BdrvChild pointer (like bs->file or bs->backing) to NULL. In that context, it also makes sense for this function to free the child. Sometimes we cannot do so, though, because it is called in a transactional context where the caller might still want to reinstate the child in the abort branch (and free it only on commit), so this behavior has to remain optional. In bdrv_replace_child_tran()'s abort handler, we now rely on the fact that the BdrvChild passed to bdrv_replace_child_tran() must have had a non-NULL .bs pointer initially. Make a note of that and assert it. Signed-off-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20211111120829.81329-10-hreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20211115145409.176785-10-kwolf@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Diffstat (limited to 'hw/misc')
0 files changed, 0 insertions, 0 deletions