[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 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);


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