[libvirt] [PATCH] util: Remove logging handlers in virExec

Daniel Veillard veillard at redhat.com
Wed Feb 3 16:18:05 UTC 2010


On Wed, Feb 03, 2010 at 07:57:42AM -0500, Cole Robinson wrote:
> On 02/03/2010 03:33 AM, Jiri Denemark wrote:
> > ...
> >> diff --git a/src/util/util.c b/src/util/util.c
> >> index cf1290d..901c0d2 100644
> >> --- a/src/util/util.c
> >> +++ b/src/util/util.c
> >> @@ -415,12 +415,19 @@ __virExec(virConnectPtr conn,
> >>          childerr = null;
> >>      }
> >>  
> >> +    /* Ensure we hold the logging lock, to protect child processes
> >> +     * from deadlocking on another threads inheirited mutex state */
> >> +    virLogLock();
> >> +
> >>      if ((pid = fork()) < 0) {
> >>          virReportSystemError(conn, errno,
> >>                               "%s", _("cannot fork child process"));
> >>          goto cleanup;
> >>      }
> >>  
> >> +    /* Unlock for both parent and child process */
> >> +    virLogUnlock();
> >> +
> >>      if (pid) { /* parent */
> >>          close(null);
> >>          if (outfd && *outfd == -1) {
> > 
> > Hmm, shouldn't we virLogUnlock() even if fork() fails? That is, something
> > like:
> > 
> >     virLogLock();
> >     pid = fork();
> >     virLogUnlock();
> > 
> >     if (pid < 0)
> >         error;
> >     else if (pid)
> >         parent;
> >     ...
> > 
> > Jirka
> > 
> 
> Argh, yes, good call. I'll update the patch and resend.
> 
> Thanks,
> Cole

  Okay I did the small change and commited the patch accordingly,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list