mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-03 02:15:23 +00:00
nodedev: Add locking in nodeNumOfDevices
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
3c4b8a7706
commit
112746cdc5
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user