On Sun, Jun 12, 2016 at 02:51:04PM +0800, Fam Zheng wrote: > @@ -119,7 +121,7 @@ static void mirror_iteration_done(MirrorOp *op, int ret) > qemu_iovec_destroy(&op->qiov); > g_free(op); > > - if (s->waiting_for_io) { > + if (s->waiting_for_io && !s->quiesce_requested) { > qemu_coroutine_enter(s->common.co, NULL); > }
Is it necessary to interact with s->waiting_for_io? The coroutine should reach a quiescent point later on anyway so it would be simpler to leave this unchanged. > +static void mirror_detach_aio_context(void *opaque) > +{ > + MirrorBlockJob *s = opaque; > + > + /* Complete pending write requests */ > + assert(!s->quiesce_requested); > + s->quiesce_requested = true; > + while (s->quiesce_requested || s->in_flight) { > + aio_poll(blk_get_aio_context(s->common.blk), true); > + } > +} Adding synchronous aio_poll() loops will bite us in the future. For example, if a guest resets the virtio device the vcpu will be hung until I/O completes and sleeps finish. This flaw in QEMU already exists today and won't be fixed any time soon, so I guess this approach is okay... Stefan
signature.asc
Description: PGP signature