]> xenbits.xensource.com Git - qemu-xen.git/commit
nbd/server: Fix drained_poll to wake coroutine in right AioContext
authorKevin Wolf <kwolf@redhat.com>
Wed, 17 May 2023 15:28:33 +0000 (17:28 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 22 May 2023 17:54:40 +0000 (20:54 +0300)
commita7002f15c8635bae3f45a7e675920164df42b77d
tree879d9c5734fb2e28514b76ce0199b4e2ec14e52a
parentd001f222e37d51aa8d691ada53b58725010e6837
nbd/server: Fix drained_poll to wake coroutine in right AioContext

nbd_drained_poll() generally runs in the main thread, not whatever
iothread the NBD server coroutine is meant to run in, so it can't
directly reenter the coroutines to wake them up.

The code seems to have the right intention, it specifies the correct
AioContext when it calls qemu_aio_coroutine_enter(). However, this
functions doesn't schedule the coroutine to run in that AioContext, but
it assumes it is already called in the home thread of the AioContext.

To fix this, add a new thread-safe qio_channel_wake_read() that can be
called in the main thread to wake up the coroutine in its AioContext,
and use this in nbd_drained_poll().

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230517152834.277483-3-kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 7c1f51bf38de8cea4ed5030467646c37b46edeb7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
include/io/channel.h
io/channel.c
nbd/server.c