mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 07:17:44 +00:00
nodedev: udev: Remove driver locks from stateInitialize and stateCleanup
The driver locks are unnecessary here, since currently the cleanup is only called from the main daemon thread, so we can't race here. Moreover @devs and @privateData are self-lockable objects, so no problem there either. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
365553645c
commit
37e02f68d0
@ -1619,13 +1619,10 @@ nodeStateCleanup(void)
|
||||
if (!driver)
|
||||
return -1;
|
||||
|
||||
nodeDeviceLock();
|
||||
|
||||
virObjectUnref(driver->privateData);
|
||||
virObjectUnref(driver->nodeDeviceEventState);
|
||||
|
||||
virNodeDeviceObjListFree(driver->devs);
|
||||
nodeDeviceUnlock();
|
||||
virMutexDestroy(&driver->lock);
|
||||
VIR_FREE(driver);
|
||||
|
||||
@ -1846,23 +1843,21 @@ nodeStateInitialize(bool privileged,
|
||||
return -1;
|
||||
}
|
||||
|
||||
nodeDeviceLock();
|
||||
|
||||
if (!(driver->devs = virNodeDeviceObjListNew()) ||
|
||||
!(priv = udevEventDataNew()))
|
||||
goto unlock;
|
||||
goto cleanup;
|
||||
|
||||
driver->privateData = priv;
|
||||
driver->nodeDeviceEventState = virObjectEventStateNew();
|
||||
|
||||
if (udevPCITranslateInit(privileged) < 0)
|
||||
goto unlock;
|
||||
goto cleanup;
|
||||
|
||||
udev = udev_new();
|
||||
if (!udev) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("failed to create udev context"));
|
||||
goto unlock;
|
||||
goto cleanup;
|
||||
}
|
||||
#if HAVE_UDEV_LOGGING
|
||||
/* cast to get rid of missing-format-attribute warning */
|
||||
@ -1908,7 +1903,6 @@ nodeStateInitialize(bool privileged,
|
||||
goto unlock;
|
||||
|
||||
virObjectUnlock(priv);
|
||||
nodeDeviceUnlock();
|
||||
|
||||
/* Populate with known devices */
|
||||
if (udevEnumerateDevices(udev) != 0)
|
||||
@ -1921,9 +1915,7 @@ nodeStateInitialize(bool privileged,
|
||||
return -1;
|
||||
|
||||
unlock:
|
||||
if (priv)
|
||||
virObjectUnlock(priv);
|
||||
nodeDeviceUnlock();
|
||||
virObjectUnlock(priv);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user