[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/3] virtio-9p-coth: add release function and fi
From: |
Greg Kurz |
Subject: |
Re: [Qemu-devel] [PATCH 1/3] virtio-9p-coth: add release function and fix init error path |
Date: |
Tue, 6 Oct 2015 11:16:21 +0200 |
On Mon, 05 Oct 2015 11:07:16 +0200
Greg Kurz <address@hidden> wrote:
> This is preliminary work to support hotplug/unplug of virtio-9p-device.
>
> Signed-off-by: Greg Kurz <address@hidden>
> ---
Hmm... still not good. Since this is shared by all virtio-9p devices, we need
at least a refcount.
> hw/9pfs/virtio-9p-coth.c | 13 +++++++++----
> hw/9pfs/virtio-9p-coth.h | 1 +
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/hw/9pfs/virtio-9p-coth.c b/hw/9pfs/virtio-9p-coth.c
> index 8185c533c013..a4392586c9a2 100644
> --- a/hw/9pfs/virtio-9p-coth.c
> +++ b/hw/9pfs/virtio-9p-coth.c
> @@ -66,10 +66,7 @@ int v9fs_init_worker_threads(void)
> }
> p->completed = g_async_queue_new();
> if (!p->completed) {
> - /*
> - * We are going to terminate.
> - * So don't worry about cleanup
> - */
> + g_thread_pool_free(p->pool, true, true);
> ret = -1;
> goto err_out;
> }
> @@ -80,3 +77,11 @@ err_out:
> pthread_sigmask(SIG_SETMASK, &oldset, NULL);
> return ret;
> }
> +
> +int v9fs_release_worker_threads(void)
> +{
> + V9fsThPool *p = &v9fs_pool;
> +
> + g_thread_pool_free(p->pool, TRUE, TRUE);
> + g_async_queue_unref(p->completed);
> +}
> diff --git a/hw/9pfs/virtio-9p-coth.h b/hw/9pfs/virtio-9p-coth.h
> index 4f51b250d1d4..6502e422cea8 100644
> --- a/hw/9pfs/virtio-9p-coth.h
> +++ b/hw/9pfs/virtio-9p-coth.h
> @@ -56,6 +56,7 @@ typedef struct V9fsThPool {
>
> extern void co_run_in_worker_bh(void *);
> extern int v9fs_init_worker_threads(void);
> +extern int v9fs_release_worker_threads(void);
> extern int v9fs_co_readlink(V9fsPDU *, V9fsPath *, V9fsString *);
> extern int v9fs_co_readdir_r(V9fsPDU *, V9fsFidState *,
> struct dirent *, struct dirent **result);
>
>