]> git.ipfire.org Git - thirdparty/qemu.git/commit
block: Activate recursively even for already active nodes
authorKevin Wolf <kwolf@redhat.com>
Tue, 17 Dec 2019 14:06:38 +0000 (15:06 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 11 May 2020 20:24:13 +0000 (15:24 -0500)
commit52a02834e0d54d59d9665e2d39c2259345df2335
tree79f81a1a56e05b8b1efce76ed45fd7bcb7bd5e87
parentda0948d13ccc4553fec74002c8fc39392a11d5e4
block: Activate recursively even for already active nodes

bdrv_invalidate_cache_all() assumes that all nodes in a given subtree
are either active or inactive when it starts. Therefore, as soon as it
arrives at an already active node, it stops.

However, this assumption is wrong. For example, it's possible to take a
snapshot of an inactive node, which results in an active overlay over an
inactive backing file. The active overlay is probably also the root node
of an inactive BlockBackend (blk->disable_perm == true).

In this case, bdrv_invalidate_cache_all() does not need to do anything
to activate the overlay node, but it still needs to recurse into the
children and the parents to make sure that after returning success,
really everything is activated.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
(cherry picked from commit 7bb4941ace471fc7dd6ded4749b95b9622baa6ed)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block.c