Commit 7b770c72 authored by Stefan Hajnoczi's avatar Stefan Hajnoczi
Browse files

mirror: fix early wake from sleep due to aio



The mirror blockjob coroutine rate-limits itself by sleeping.  The
coroutine also performs I/O asynchronously so it's important that the
aio callback doesn't wake the coroutine early as that breaks
rate-limiting.

Reported-by: default avatarJoaquim Barrera <jbarrera@ac.upc.edu>
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent cc8c9d6c
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -98,8 +98,15 @@ static void mirror_iteration_done(MirrorOp *op, int ret)

    qemu_iovec_destroy(&op->qiov);
    g_slice_free(MirrorOp, op);

    /* Enter coroutine when it is not sleeping.  The coroutine sleeps to
     * rate-limit itself.  The coroutine will eventually resume since there is
     * a sleep timeout so don't wake it early.
     */
    if (s->common.busy) {
        qemu_coroutine_enter(s->common.co, NULL);
    }
}

static void mirror_write_complete(void *opaque, int ret)
{