[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 19/24] tests: fixes aio-win32 about aio_remove_fd_handler, get it
From: |
Thomas Huth |
Subject: |
[PULL 19/24] tests: fixes aio-win32 about aio_remove_fd_handler, get it consistence with aio-posix.c |
Date: |
Wed, 16 Sep 2020 13:47:26 +0200 |
From: Yonggang Luo <luoyonggang@gmail.com>
This is a fixes for
(C:\work\xemu\qemu\build\tests\test-aio-multithread.exe:19100): GLib-CRITICAL
**: 23:03:24.965: g_source_remove_poll: assertion '!SOURCE_DESTROYED (source)'
failed
ERROR test-aio-multithread - Bail out! GLib-FATAL-CRITICAL:
g_source_remove_poll: assertion '!SOURCE_DESTROYED (source)' failed
(C:\work\xemu\qemu\build\tests\test-bdrv-drain.exe:21036): GLib-CRITICAL **:
23:03:29.861: g_source_remove_poll: assertion '!SOURCE_DESTROYED (source)'
failed
ERROR test-bdrv-drain - Bail out! GLib-FATAL-CRITICAL: g_source_remove_poll:
assertion '!SOURCE_DESTROYED (source)' failed
And the idea comes from https://patchwork.kernel.org/patch/9975239/
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Message-Id: <20200915171234.236-19-luoyonggang@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
util/aio-win32.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/util/aio-win32.c b/util/aio-win32.c
index 953c56ab48..49bd90e62e 100644
--- a/util/aio-win32.c
+++ b/util/aio-win32.c
@@ -37,6 +37,16 @@ struct AioHandler {
static void aio_remove_fd_handler(AioContext *ctx, AioHandler *node)
{
+ /*
+ * If the GSource is in the process of being destroyed then
+ * g_source_remove_poll() causes an assertion failure. Skip
+ * removal in that case, because glib cleans up its state during
+ * destruction anyway.
+ */
+ if (!g_source_is_destroyed(&ctx->source)) {
+ g_source_remove_poll(&ctx->source, &node->pfd);
+ }
+
/* If aio_poll is in progress, just mark the node as deleted */
if (qemu_lockcnt_count(&ctx->list_lock)) {
node->deleted = 1;
@@ -139,8 +149,6 @@ void aio_set_event_notifier(AioContext *ctx,
/* Are we deleting the fd handler? */
if (!io_notify) {
if (node) {
- g_source_remove_poll(&ctx->source, &node->pfd);
-
aio_remove_fd_handler(ctx, node);
}
} else {
--
2.18.2
- [PULL 07/24] rcu: Implement drain_call_rcu, (continued)
- [PULL 07/24] rcu: Implement drain_call_rcu, Thomas Huth, 2020/09/16
- [PULL 10/24] meson: Disable test-char on msys2/mingw for fixing tests stuck, Thomas Huth, 2020/09/16
- [PULL 09/24] rcu: fixes test-logging.c by call drain_call_rcu before rmdir_full, Thomas Huth, 2020/09/16
- [PULL 11/24] meson: disable crypto tests are empty under win32, Thomas Huth, 2020/09/16
- [PULL 12/24] tests: Fixes test-replication.c on msys2/mingw., Thomas Huth, 2020/09/16
- [PULL 14/24] osdep: file locking functions are not available on Win32, Thomas Huth, 2020/09/16
- [PULL 15/24] meson: Use -b to ignore CR vs. CR-LF issues on Windows, Thomas Huth, 2020/09/16
- [PULL 13/24] tests: test-replication disable /replication/secondary/* on msys2/mingw., Thomas Huth, 2020/09/16
- [PULL 16/24] meson: remove empty else and duplicated gio deps, Thomas Huth, 2020/09/16
- [PULL 17/24] vmstate: Fixes test-vmstate.c on msys2/mingw, Thomas Huth, 2020/09/16
- [PULL 19/24] tests: fixes aio-win32 about aio_remove_fd_handler, get it consistence with aio-posix.c,
Thomas Huth <=
- [PULL 18/24] tests: Fixes test-io-channel-socket.c tests under msys2/mingw, Thomas Huth, 2020/09/16
- [PULL 20/24] tests: Fixes test-io-channel-file by mask only owner file state mask bits, Thomas Huth, 2020/09/16
- [PULL 22/24] tests: Fixes test-qdev-global-props.c, Thomas Huth, 2020/09/16
- [PULL 21/24] tests: fix test-util-sockets.c, Thomas Huth, 2020/09/16
- [PULL 23/24] ci: Enable msys2 ci in cirrus, Thomas Huth, 2020/09/16
- [PULL 24/24] cirrus: Building freebsd in a single shot, Thomas Huth, 2020/09/16
- Re: [PULL 00/24] qtests, unit tests and Cirrus-CI fixes / improvements, Peter Maydell, 2020/09/17
- Re: [PULL 00/24] qtests, unit tests and Cirrus-CI fixes / improvements, Peter Maydell, 2020/09/17