]> git.proxmox.com Git - pve-qemu.git/commitdiff
fix #1071: use correct AioContext to cope with IOThreads
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 21 Oct 2019 10:22:35 +0000 (12:22 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 21 Oct 2019 13:51:43 +0000 (15:51 +0200)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
debian/patches/pve/0032-PVE-bug-fix-1071-vma-writer.c-use-correct-AioContext.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/pve/0032-PVE-bug-fix-1071-vma-writer.c-use-correct-AioContext.patch b/debian/patches/pve/0032-PVE-bug-fix-1071-vma-writer.c-use-correct-AioContext.patch
new file mode 100644 (file)
index 0000000..addca82
--- /dev/null
@@ -0,0 +1,52 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Dietmar Maurer <dietmar@proxmox.com>
+Date: Mon, 21 Oct 2019 11:51:57 +0200
+Subject: [PATCH] PVE bug fix #1071 - vma-writer.c: use correct AioContext
+
+Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
+---
+ vma-writer.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/vma-writer.c b/vma-writer.c
+index fd9567634d..b163fa2d3a 100644
+--- a/vma-writer.c
++++ b/vma-writer.c
+@@ -199,12 +199,14 @@ int vma_writer_register_stream(VmaWriter *vmaw, const char *devname,
+     return n;
+ }
+
+-static void vma_co_continue_write(void *opaque)
++static void coroutine_fn yield_until_fd_writable(int fd)
+ {
+-    VmaWriter *vmaw = opaque;
+-
+-    DPRINTF("vma_co_continue_write\n");
+-    qemu_coroutine_enter(vmaw->co_writer);
++    assert(qemu_in_coroutine());
++    AioContext *ctx = qemu_get_current_aio_context();
++    aio_set_fd_handler(ctx, fd, false, NULL, (IOHandler *)qemu_coroutine_enter,
++                       NULL, qemu_coroutine_self());
++    qemu_coroutine_yield();
++    aio_set_fd_handler(ctx, fd, false, NULL, NULL, NULL, NULL);
+ }
+
+ static ssize_t coroutine_fn
+@@ -224,14 +226,12 @@ vma_queue_write(VmaWriter *vmaw, const void *buf, size_t bytes)
+     vmaw->co_writer = qemu_coroutine_self();
+
+     while (done < bytes) {
+-        aio_set_fd_handler(qemu_get_aio_context(), vmaw->fd, false, NULL, vma_co_continue_write, NULL, vmaw);
+-        qemu_coroutine_yield();
+-        aio_set_fd_handler(qemu_get_aio_context(), vmaw->fd, false, NULL, NULL, NULL, NULL);
+         if (vmaw->status < 0) {
+             DPRINTF("vma_queue_write detected canceled backup\n");
+             done = -1;
+             break;
+         }
++        yield_until_fd_writable(vmaw->fd);
+         ret = write(vmaw->fd, buf + done, bytes - done);
+         if (ret > 0) {
+             done += ret;
+--
+2.20.1
index 9e413bcbf2d9564971800485ba86e0ae3d7c58b0..6c045786fa1bd67bd872bc421128d74cce5c2bc7 100644 (file)
@@ -34,3 +34,4 @@ pve/0028-docs-recommend-use-of-md-clear-feature-on-all-Intel-.patch
 pve/0029-PVE-savevm-async-kick-AIO-wait-on-block-state-write.patch
 pve/0030-PVE-move-snapshot-cleanup-into-bottom-half.patch
 pve/0031-PVE-monitor-disable-oob-capability.patch
+pve/0032-PVE-bug-fix-1071-vma-writer.c-use-correct-AioContext.patch