On Wed, 06/24 18:14, Max Reitz wrote: > On 09.06.2015 04:13, Fam Zheng wrote: > >In block/backup.c, we already check and add blocker on the target bs, > >which is necessary so that it won't be intervened with other operations. > > > >In block/mirror.c we should also protect the mirror target bs, because it > >could have a node-name (drive-mirror ... node-name=XXX), and on top of > >that it's safe to add blockdev-mirror. > > > >Signed-off-by: Fam Zheng <f...@redhat.com> > >--- > > block/mirror.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > >diff --git a/block/mirror.c b/block/mirror.c > >index 33c640f..8b23ddd 100644 > >--- a/block/mirror.c > >+++ b/block/mirror.c > >@@ -360,6 +360,7 @@ static void mirror_exit(BlockJob *job, void *opaque) > > aio_context_release(replace_aio_context); > > } > > g_free(s->replaces); > >+ bdrv_op_unblock_all(s->target, s->common.blocker); > > bdrv_unref(s->target); > > block_job_completed(&s->common, data->ret); > > g_free(data); > >@@ -682,6 +683,7 @@ static void mirror_start_job(BlockDriverState *bs, > >BlockDriverState *target, > > return; > > } > >+ bdrv_op_block_all(target, s->common.blocker); > > s->replaces = g_strdup(replaces); > > s->on_source_error = on_source_error; > > s->on_target_error = on_target_error; > > Do we need a bdrv_op_unblock_all() if bdrv_create_dirty_bitmap() fails? >
Yes, good catch! Fam