mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
util/vhost-user-server: rework vu_client_trip() coroutine lifecycle
The vu_client_trip() coroutine is leaked during AioContext switching. It is also unsafe to destroy the vu_dev in panic_cb() since its callers still access it in some cases. Rework the lifecycle to solve these safety issues. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200924151549.913737-10-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
edaf6205a3
commit
7185c85776
3 changed files with 157 additions and 130 deletions
|
@ -313,18 +313,13 @@ static const VuDevIface vu_block_iface = {
|
|||
static void blk_aio_attached(AioContext *ctx, void *opaque)
|
||||
{
|
||||
VuBlockDev *vub_dev = opaque;
|
||||
aio_context_acquire(ctx);
|
||||
vhost_user_server_set_aio_context(&vub_dev->vu_server, ctx);
|
||||
aio_context_release(ctx);
|
||||
vhost_user_server_attach_aio_context(&vub_dev->vu_server, ctx);
|
||||
}
|
||||
|
||||
static void blk_aio_detach(void *opaque)
|
||||
{
|
||||
VuBlockDev *vub_dev = opaque;
|
||||
AioContext *ctx = vub_dev->vu_server.ctx;
|
||||
aio_context_acquire(ctx);
|
||||
vhost_user_server_set_aio_context(&vub_dev->vu_server, NULL);
|
||||
aio_context_release(ctx);
|
||||
vhost_user_server_detach_aio_context(&vub_dev->vu_server);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue