From: Jim Fehlig Date: Thu, 16 Jan 2014 23:16:37 +0000 (+0000) Subject: libxl: improve subprocess handling X-Git-Tag: v1.2.2-rc1~158 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=778067e19593f223f76aba99e18d608cbf3247c7;p=thirdparty%2Flibvirt.git libxl: improve subprocess handling If available, let libxl handle reaping any children it creates by specifying libxl_sigchld_owner_libxl_always_selective_reap. This feature was added to improve subprocess handling in libxl when used in an application that does not install a SIGCHLD handler like libvirt http://lists.xen.org/archives/html/xen-devel/2014-01/msg01555.html Prior to this patch, it is possible to hit asserts in libxl when reaping subprocesses, particularly during simultaneous operations on multiple domains. With this patch, and the corresponding changes to libxl, I no longer see the asserts. Note that the libxl changes will be included in Xen 4.4.0. Previous Xen versions will be susceptible to hitting the asserts even with this patch applied to the libvirt libxl driver. Signed-off-by: Jim Fehlig --- diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index fbd6cab333..eb2e50e20b 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -358,6 +358,14 @@ virDomainDefParserConfig libxlDomainDefParserConfig = { .devicesPostParseCallback = libxlDomainDeviceDefPostParse, }; +static const libxl_childproc_hooks libxl_child_hooks = { +#ifdef LIBXL_HAVE_SIGCHLD_OWNER_SELECTIVE_REAP + .chldowner = libxl_sigchld_owner_libxl_always_selective_reap, +#else + .chldowner = libxl_sigchld_owner_libxl, +#endif +}; + int libxlDomainObjPrivateInitCtx(virDomainObjPtr vm) { @@ -395,6 +403,7 @@ libxlDomainObjPrivateInitCtx(virDomainObjPtr vm) } libxl_osevent_register_hooks(priv->ctx, &libxl_event_callbacks, priv); + libxl_childproc_setmode(priv->ctx, &libxl_child_hooks, priv); ret = 0;