diff options
author | Fam Zheng <famz@redhat.com> | 2016-05-11 10:45:33 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-05-12 15:22:09 +0200 |
commit | 0d1c5c91607d1c55a8f5db39c57c6e5c76e21131 (patch) | |
tree | 34909cc559768490b577f4975f46eec9ab1ca441 | |
parent | 52a46505742cce4b4b7f88d32636f848287e6bfb (diff) |
block: Invalidate all children
Currently we only recurse to bs->file, which will miss the children in quorum
and VMDK.
Recurse into the whole subtree to avoid that.
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | block.c | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -3198,6 +3198,7 @@ void bdrv_init_with_whitelist(void) void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp) { + BdrvChild *child; Error *local_err = NULL; int ret; @@ -3212,13 +3213,20 @@ void bdrv_invalidate_cache(BlockDriverState *bs, Error **errp) if (bs->drv->bdrv_invalidate_cache) { bs->drv->bdrv_invalidate_cache(bs, &local_err); - } else if (bs->file) { - bdrv_invalidate_cache(bs->file->bs, &local_err); + if (local_err) { + bs->open_flags |= BDRV_O_INACTIVE; + error_propagate(errp, local_err); + return; + } } - if (local_err) { - bs->open_flags |= BDRV_O_INACTIVE; - error_propagate(errp, local_err); - return; + + QLIST_FOREACH(child, &bs->children, next) { + bdrv_invalidate_cache(child->bs, &local_err); + if (local_err) { + bs->open_flags |= BDRV_O_INACTIVE; + error_propagate(errp, local_err); + return; + } } ret = refresh_total_sectors(bs, bs->total_sectors); |