@@ -1065,10 +1065,14 @@ static int coroutine_fn mirror_run(Job *job, Error **errp)
trace_mirror_before_drain(s, cnt);
s->in_drain = true;
+ bdrv_graph_co_rdlock();
bdrv_drained_begin(bs);
+ bdrv_graph_co_rdunlock();
cnt = bdrv_get_dirty_count(s->dirty_bitmap);
if (cnt > 0 || mirror_flush(s) < 0) {
+ bdrv_graph_co_rdlock();
bdrv_drained_end(bs);
+ bdrv_graph_co_rdunlock();
s->in_drain = false;
continue;
}
@@ -1110,7 +1114,9 @@ immediate_exit:
if (need_drain) {
s->in_drain = true;
+ bdrv_graph_co_rdlock();
bdrv_drained_begin(bs);
+ bdrv_graph_co_rdunlock();
}
return ret;
Drain performed in coroutine schedules a bh in the main loop. However, drain itself still is a read, and we need to signal the writer that we are going through the graph. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> --- block/mirror.c | 6 ++++++ 1 file changed, 6 insertions(+)