From e12f3784097a26a1ba51be420f41038b4c0ae5d1 Mon Sep 17 00:00:00 2001 From: Wen Congyang Date: Fri, 17 Jul 2015 10:12:22 +0800 Subject: block: more check for replaced node We use mirror+replace to fix quorum's broken child. bs/s->common.bs is quorum, and to_replace is the broken child. The new child is target_bs. Without this patch, the replace node can be any node, and it can be top BDS with BB, or another quorum's child. We just check if the broken child is part of the quorum BDS in this patch. Signed-off-by: Wen Congyang Message-id: 55A86486.1000404@cn.fujitsu.com Signed-off-by: Stefan Hajnoczi --- block.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'block.c') diff --git a/block.c b/block.c index d088ee02ff..090923c312 100644 --- a/block.c +++ b/block.c @@ -4077,7 +4077,8 @@ bool bdrv_is_first_non_filter(BlockDriverState *candidate) return false; } -BlockDriverState *check_to_replace_node(const char *node_name, Error **errp) +BlockDriverState *check_to_replace_node(BlockDriverState *parent_bs, + const char *node_name, Error **errp) { BlockDriverState *to_replace_bs = bdrv_find_node(node_name); AioContext *aio_context; @@ -4100,7 +4101,7 @@ BlockDriverState *check_to_replace_node(const char *node_name, Error **errp) * Another benefit is that this tests exclude backing files which are * blocked by the backing blockers. */ - if (!bdrv_is_first_non_filter(to_replace_bs)) { + if (!bdrv_recurse_is_first_non_filter(parent_bs, to_replace_bs)) { error_setg(errp, "Only top most non filter can be replaced"); to_replace_bs = NULL; goto out; -- cgit v1.2.3