[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] A glib warning encountered with internal iothread
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] A glib warning encountered with internal iothread |
Date: |
Wed, 27 Sep 2017 13:17:53 +0100 |
User-agent: |
Mutt/1.8.3 (2017-05-23) |
On Tue, Sep 26, 2017 at 07:13:43PM +0800, Fam Zheng wrote:
> On Tue, 09/26 17:11, Peter Xu wrote:
> void aio_context_unref(AioContext *ctx)
> {
> + assert(ctx->refcnt > 0);
> + if (--ctx->refcnt == 0) {
> + aio_set_event_notifier(ctx, &ctx->notifier, false, NULL, NULL);
> + }
This isn't a general solution because Linux AIO also has a file
descriptor that is removed in aio_ctx_finalize().
Here is a different approach. Does it work for you?
BTW I'm not a glib expert so maybe we're abusing the API and missing the
obvious way to structure our code :).
diff --git a/util/aio-posix.c b/util/aio-posix.c
index 2d51239ec6..5946ac09f0 100644
--- a/util/aio-posix.c
+++ b/util/aio-posix.c
@@ -223,7 +223,14 @@ void aio_set_fd_handler(AioContext *ctx,
return;
}
- g_source_remove_poll(&ctx->source, &node->pfd);
+ /* 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 the lock is held, just mark the node as deleted */
if (qemu_lockcnt_count(&ctx->list_lock)) {
- [Qemu-devel] A glib warning encountered with internal iothread, Peter Xu, 2017/09/26
- Re: [Qemu-devel] A glib warning encountered with internal iothread, Stefan Hajnoczi, 2017/09/26
- Re: [Qemu-devel] A glib warning encountered with internal iothread, Peter Xu, 2017/09/26
- Re: [Qemu-devel] A glib warning encountered with internal iothread, Fam Zheng, 2017/09/26
- Re: [Qemu-devel] A glib warning encountered with internal iothread, Peter Xu, 2017/09/27
- Re: [Qemu-devel] A glib warning encountered with internal iothread,
Stefan Hajnoczi <=
- Re: [Qemu-devel] A glib warning encountered with internal iothread, Fam Zheng, 2017/09/27
- Re: [Qemu-devel] A glib warning encountered with internal iothread, Paolo Bonzini, 2017/09/27
- Re: [Qemu-devel] A glib warning encountered with internal iothread, Peter Xu, 2017/09/27