mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-10 13:41:35 +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;
|
int ndevs = 0;
|
||||||
unsigned int i;
|
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) ||
|
if ((cap == NULL) ||
|
||||||
dev_has_cap(driver->devs.objs[i], cap))
|
dev_has_cap(driver->devs.objs[i], cap))
|
||||||
++ndevs;
|
++ndevs;
|
||||||
|
virNodeDeviceObjUnlock(driver->devs.objs[i]);
|
||||||
|
}
|
||||||
|
nodeDeviceUnlock(driver);
|
||||||
|
|
||||||
return ndevs;
|
return ndevs;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user