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

Wen Congyang wency at cn.fujitsu.com
Thu Apr 14 05:53:19 UTC 2011


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 :)




More information about the libvir-list mailing list