From 1a63a907507fbbcfaee3f622907ec244b7eabda8 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 6 Dec 2017 20:24:44 +0100 Subject: block: Keep nodes drained between reopen_queue/multiple The bdrv_reopen*() implementation doesn't like it if the graph is changed between queuing nodes for reopen and actually reopening them (one of the reasons is that queuing can be recursive). So instead of draining the device only in bdrv_reopen_multiple(), require that callers already drained all affected nodes, and assert this in bdrv_reopen_queue(). Signed-off-by: Kevin Wolf Reviewed-by: Fam Zheng --- qemu-io-cmds.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'qemu-io-cmds.c') diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index de8e3de726..a6a70fc3dc 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -2013,8 +2013,11 @@ static int reopen_f(BlockBackend *blk, int argc, char **argv) opts = qopts ? qemu_opts_to_qdict(qopts, NULL) : NULL; qemu_opts_reset(&reopen_opts); + bdrv_subtree_drained_begin(bs); brq = bdrv_reopen_queue(NULL, bs, opts, flags); bdrv_reopen_multiple(bdrv_get_aio_context(bs), brq, &local_err); + bdrv_subtree_drained_end(bs); + if (local_err) { error_report_err(local_err); } else { -- cgit v1.2.3-55-g7522