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

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

 



On Wed, Mar 30, 2011 at 12:34:47PM +0800, Wen Congyang wrote:
> ---
>  src/qemu/qemu_driver.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index dd12dc8..f843dc8 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -628,10 +628,14 @@ qemudStartup(int privileged) {
>  
>      qemuAutostartDomains(qemu_driver);
>  
> +    /* Lock qemu_drive again as we will modify it */
> +    qemuDriverLock(qemu_driver);
>      qemu_driver->workerPool = virThreadPoolNew(0, 1, processWatchdogEvent, qemu_driver);
>      if (!qemu_driver->workerPool)
>          goto error;
>  
> +    qemuDriverUnlock(qemu_driver);
> +
>      if (conn)
>          virConnectClose(conn);
>  
> -- 
> 1.7.1

Looks strange although it's right, What about this?

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 104e92d..91432ed 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);

--
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]