[pve-devel] [PATCH pve-qemu] add patch to fix #1071

Dietmar Maurer dietmar at proxmox.com
Mon Oct 21 12:22:35 CEST 2019


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 ...-vma-writer.c-use-correct-AioContext.patch | 52 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 53 insertions(+)
 create mode 100644 debian/patches/pve/0032-PVE-bug-fix-1071-vma-writer.c-use-correct-AioContext.patch

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
index 0000000..addca82
--- /dev/null
+++ b/debian/patches/pve/0032-PVE-bug-fix-1071-vma-writer.c-use-correct-AioContext.patch
@@ -0,0 +1,52 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Dietmar Maurer <dietmar at 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 at 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
diff --git a/debian/patches/series b/debian/patches/series
index ce96303..7097343 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -33,3 +33,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
-- 
2.20.1




More information about the pve-devel mailing list