提交 6215b036 编写于 作者: E Erik Skultety

nodedev: udev: Unlock the private data before setting up 'system' node

udevSetupSystemDev only needs the udev data lock to be locked because of
calling udevGetDMIData which accesses some protected structure members,
but it can do that on its own just fine, no need to hold the lock the
whole time.
Signed-off-by: NErik Skultety <eskultet@redhat.com>
上级 37e02f68
...@@ -1719,6 +1719,7 @@ udevGetDMIData(virNodeDevCapSystemPtr syscap) ...@@ -1719,6 +1719,7 @@ udevGetDMIData(virNodeDevCapSystemPtr syscap)
virNodeDevCapSystemHardwarePtr hardware = &syscap->hardware; virNodeDevCapSystemHardwarePtr hardware = &syscap->hardware;
virNodeDevCapSystemFirmwarePtr firmware = &syscap->firmware; virNodeDevCapSystemFirmwarePtr firmware = &syscap->firmware;
virObjectLock(priv);
udev = udev_monitor_get_udev(priv->udev_monitor); udev = udev_monitor_get_udev(priv->udev_monitor);
device = udev_device_new_from_syspath(udev, DMI_DEVPATH); device = udev_device_new_from_syspath(udev, DMI_DEVPATH);
...@@ -1728,9 +1729,11 @@ udevGetDMIData(virNodeDevCapSystemPtr syscap) ...@@ -1728,9 +1729,11 @@ udevGetDMIData(virNodeDevCapSystemPtr syscap)
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to get udev device for syspath '%s' or '%s'"), _("Failed to get udev device for syspath '%s' or '%s'"),
DMI_DEVPATH, DMI_DEVPATH_FALLBACK); DMI_DEVPATH, DMI_DEVPATH_FALLBACK);
virObjectUnlock(priv);
return; return;
} }
} }
virObjectUnlock(priv);
if (udevGetStringSysfsAttr(device, "product_name", if (udevGetStringSysfsAttr(device, "product_name",
&syscap->product_name) < 0) &syscap->product_name) < 0)
...@@ -1898,11 +1901,11 @@ nodeStateInitialize(bool privileged, ...@@ -1898,11 +1901,11 @@ nodeStateInitialize(bool privileged,
if (priv->watch == -1) if (priv->watch == -1)
goto unlock; goto unlock;
virObjectUnlock(priv);
/* Create a fictional 'computer' device to root the device tree. */ /* Create a fictional 'computer' device to root the device tree. */
if (udevSetupSystemDev() != 0) if (udevSetupSystemDev() != 0)
goto unlock; goto cleanup;
virObjectUnlock(priv);
/* Populate with known devices */ /* Populate with known devices */
if (udevEnumerateDevices(udev) != 0) if (udevEnumerateDevices(udev) != 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册