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

Re: [libvirt] [PATCH 1/5] nodedev: Add locking in nodeNumOfDevices



On Fri, Oct 02, 2009 at 12:05:01PM -0400, Cole Robinson wrote:
> Signed-off-by: Cole Robinson <crobinso redhat com>
> ---
>  src/node_device/node_device_driver.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
> index 93ca28c..c902e7d 100644
> --- a/src/node_device/node_device_driver.c
> +++ b/src/node_device/node_device_driver.c
> @@ -153,10 +153,15 @@ static int nodeNumOfDevices(virConnectPtr conn,
>      int ndevs = 0;
>      unsigned int i;
>  
> -    for (i = 0; i < driver->devs.count; i++)
> +    nodeDeviceLock(driver);
> +    for (i = 0; i < driver->devs.count; i++) {
> +        virNodeDeviceObjLock(driver->devs.objs[i]);
>          if ((cap == NULL) ||
>              dev_has_cap(driver->devs.objs[i], cap))
>              ++ndevs;
> +        virNodeDeviceObjUnlock(driver->devs.objs[i]);
> +    }
> +    nodeDeviceUnlock(driver);
>  
>      return ndevs;

Opps !  I'll have to look into why this bug wasn't detected by the
locking test suite

AC 

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


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