Received: from eggs.gnu.org ([2001:4830:134:3::10]:33852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjOMJ-0001Y2-47 for qemu-devel@nongnu.org; Tue, 06 Oct 2015 05:16:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjOMF-0006Ey-Sf for qemu-devel@nongnu.org; Tue, 06 Oct 2015 05:16:31 -0400 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:53354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjOMF-0006Eh-Jw for qemu-devel@nongnu.org; Tue, 06 Oct 2015 05:16:27 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 6 Oct 2015 10:16:26 +0100 Date: Tue, 6 Oct 2015 11:16:21 +0200 From: Greg Kurz Message-ID: <20151006111621.479b7cff@bahia.local> In-Reply-To: <20151005090716.20420.21354.stgit@bahia.huguette.org> References: <20151005090710.20420.26941.stgit@bahia.huguette.org> <20151005090716.20420.21354.stgit@bahia.huguette.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/3] virtio-9p-coth: add release function and fix init error path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aneesh.kumar@linux.vnet.ibm.com Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" On Mon, 05 Oct 2015 11:07:16 +0200 Greg Kurz wrote: > This is preliminary work to support hotplug/unplug of virtio-9p-device. > > Signed-off-by: Greg Kurz > --- 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); > >