[libvirt] [PATCH] Daemonize fuse thread in libvirt_lxc

From: "Daniel P. Berrange" <berrange@redhat.com> In some startup failure modes, the fuse thread may get itself wedged. This will cause the entire libvirt_lxc process to hang trying to the join the thread. There is no compelling reason to wait for the thread to exit if the whole process is exiting, so kust daemonize the fus thread instead. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/lxc/lxc_fuse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index b6808da..c4be58e 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -320,7 +320,7 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def) goto cleanup1; } - if (virThreadCreate(&fuse->thread, true, lxcFuseRun, + if (virThreadCreate(&fuse->thread, false, lxcFuseRun, (void *)fuse) < 0) { lxcFuseDestroy(fuse); goto cleanup1; @@ -351,8 +351,6 @@ void lxcFreeFuse(virLXCFusePtr *f) fuse_exit(fuse->fuse); virMutexUnlock(&fuse->lock); - virThreadJoin(&fuse->thread); - VIR_FREE(fuse->mountpoint); VIR_FREE(*f); } -- 1.7.11.7

On 03/07/2013 12:02 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
In some startup failure modes, the fuse thread may get itself wedged. This will cause the entire libvirt_lxc process to hang trying to the join the thread. There is no compelling reason to wait for the thread to exit if the whole process is exiting, so kust daemonize the fus thread instead.
s/kust/just/; s/fus/fuse/
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/lxc/lxc_fuse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Thu, Mar 7, 2013 at 2:59 PM, Eric Blake <eblake@redhat.com> wrote:
On 03/07/2013 12:02 PM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
In some startup failure modes, the fuse thread may get itself wedged. This will cause the entire libvirt_lxc process to hang trying to the join the thread. There is no compelling reason to wait for the thread to exit if the whole process is exiting, so kust daemonize the fus thread instead.
s/kust/just/; s/fus/fuse/
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/lxc/lxc_fuse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
ACK.
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Backported to v1.0.3-maint. Thanks. -- Doug Goldstein

On 2013/03/08 03:02, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
In some startup failure modes, the fuse thread may get itself wedged. This will cause the entire libvirt_lxc process to hang trying to the join the thread. There is no compelling reason to wait for the thread to exit if the whole process is exiting, so kust daemonize the fus thread instead.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> ---
ACK. Thanks!
src/lxc/lxc_fuse.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index b6808da..c4be58e 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -320,7 +320,7 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def) goto cleanup1; }
- if (virThreadCreate(&fuse->thread, true, lxcFuseRun, + if (virThreadCreate(&fuse->thread, false, lxcFuseRun, (void *)fuse) < 0) { lxcFuseDestroy(fuse); goto cleanup1; @@ -351,8 +351,6 @@ void lxcFreeFuse(virLXCFusePtr *f) fuse_exit(fuse->fuse); virMutexUnlock(&fuse->lock);
- virThreadJoin(&fuse->thread); - VIR_FREE(fuse->mountpoint); VIR_FREE(*f); }
participants (4)
-
Daniel P. Berrange
-
Doug Goldstein
-
Eric Blake
-
Gao feng