Currently we only inactivate the top BDS. Actually bdrv_inactivate should be the opposite of bdrv_invalidate_cache.
Recurse into the whole subtree instead. Signed-off-by: Fam Zheng <f...@redhat.com> --- block.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block.c b/block.c index fa8b38f..9a84ed1 100644 --- a/block.c +++ b/block.c @@ -3260,8 +3260,16 @@ void bdrv_invalidate_cache_all(Error **errp) static int bdrv_inactivate(BlockDriverState *bs) { + BdrvChild *child; int ret; + QLIST_FOREACH(child, &bs->children, next) { + ret = bdrv_inactivate(child->bs); + if (ret < 0) { + return ret; + } + } + if (bs->drv->bdrv_inactivate) { ret = bs->drv->bdrv_inactivate(bs); if (ret < 0) { -- 2.8.0