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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]