mirror of
git://git.proxmox.com/git/pve-qemu.git
synced 2024-12-23 21:35:23 +03:00
fix #1071: use correct AioContext to cope with IOThreads
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
376d9ce806
commit
69cb18950a
52
debian/patches/pve/0032-PVE-bug-fix-1071-vma-writer.c-use-correct-AioContext.patch
vendored
Normal file
52
debian/patches/pve/0032-PVE-bug-fix-1071-vma-writer.c-use-correct-AioContext.patch
vendored
Normal file
@ -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
|
1
debian/patches/series
vendored
1
debian/patches/series
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user