]> Git Repo - qemu.git/commitdiff
mirror: fix early wake from sleep due to aio
authorStefan Hajnoczi <[email protected]>
Fri, 21 Mar 2014 12:55:19 +0000 (13:55 +0100)
committerStefan Hajnoczi <[email protected]>
Tue, 25 Mar 2014 13:09:50 +0000 (14:09 +0100)
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: Joaquim Barrera <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
block/mirror.c

index adb09cf4ab20ed6691f7d9801e8e09ce639b2664..0ef41f999e405b295df1ee02666a4bcddf06200e 100644 (file)
@@ -98,7 +98,14 @@ static void mirror_iteration_done(MirrorOp *op, int ret)
 
     qemu_iovec_destroy(&op->qiov);
     g_slice_free(MirrorOp, op);
-    qemu_coroutine_enter(s->common.co, NULL);
+
+    /* 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)
This page took 0.027179 seconds and 4 git commands to generate.