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

Re: [libvirt] [PATCH 1/3] qemu: avoid qemu_driver being unlocked twice when virThreadPoolNew() failed



On Thu, Apr 14, 2011 at 01:53:19PM +0800, Wen Congyang wrote:
> At 04/06/2011 03:53 PM, Wen Congyang Write:
> > We do not lock qemu_driver when calling virThreadPoolNew(). If it failed,
> > we will unlock qemu_driver. It is dangerous.
> > 
> > We may use this pool during auto starting domains. So we must create it before
> > calling qemuAutostartDomains(). Otherwise, libvirtd will crash.
> > 
> > ---
> >  src/qemu/qemu_driver.c |    8 ++++----
> >  1 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> > index 48fe266..dd84f65 100644
> > --- a/src/qemu/qemu_driver.c
> > +++ b/src/qemu/qemu_driver.c
> > @@ -624,14 +624,14 @@ qemudStartup(int privileged) {
> >      virHashForEach(qemu_driver->domains.objs, qemuDomainSnapshotLoad,
> >                     qemu_driver->snapshotDir);
> >  
> > -    qemuDriverUnlock(qemu_driver);
> > -
> > -    qemuAutostartDomains(qemu_driver);
> > -
> >      qemu_driver->workerPool = virThreadPoolNew(0, 1, processWatchdogEvent, qemu_driver);
> >      if (!qemu_driver->workerPool)
> >          goto error;
> >  
> > +    qemuDriverUnlock(qemu_driver);
> > +
> > +    qemuAutostartDomains(qemu_driver);
> > +
> >      if (conn)
> >          virConnectClose(conn);
> >  
> Ping :)

ACK

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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