[libvirt] [PATCH] nwfilter: Add missing driver lock in qemu driver

Daniel P. Berrange berrange at redhat.com
Sun May 16 09:08:38 UTC 2010


On Fri, May 14, 2010 at 01:39:28PM -0400, Stefan Berger wrote:
> This adds a missing driver lock in the qemu driver to protect
> the list of domains.
> 
> Signed-off-by: Stefan Berger <stefanb at us.ibm.com>
> 
> ---
>  src/qemu/qemu_driver.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> Index: libvirt-acl/src/qemu/qemu_driver.c
> ===================================================================
> --- libvirt-acl.orig/src/qemu/qemu_driver.c
> +++ libvirt-acl/src/qemu/qemu_driver.c
> @@ -11869,11 +11869,15 @@ static virStateDriver qemuStateDriver = 
>  };
>  
>  static int
> -qemudVMFilterRebuild(virConnectPtr conn,
> +qemudVMFilterRebuild(virConnectPtr conn ATTRIBUTE_UNUSED,
>                       virHashIterator iter, void *data)
>  {
> -    (void)conn;
> +    struct qemud_driver *driver = qemu_driver;
> +
> +    qemuDriverLock(driver);
>      virHashForEach(qemu_driver->domains.objs, iter, data);
> +    qemuDriverUnlock(driver);
> +
>      return 0;
>  }

ACK, traced back the code for 'iter' and that's already correctly locking
the elements when it accesses them, so this is only bit broken.


Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list