Skip to contentSkip to conversation

2018-06-01-stable - apply obtain_device_list_from_udev to all libudev usage

PATCH David Teigland 1 participant 1 message Feb 5, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=57cde6063f3073e73542c5f7f59d0269ad9b703b
Commit:        57cde6063f3073e73542c5f7f59d0269ad9b703b
Parent:        d0cb672466437161055ac084a5c1523b0eec1bf5
Author:        David Teigland <[email protected]>
AuthorDate:    Tue Feb 5 10:15:40 2019 -0600
Committer:     David Teigland <[email protected]>
CommitterDate: Tue Feb 5 10:20:24 2019 -0600

apply obtain_device_list_from_udev to all libudev usage

udev_dev_is_md_component and udev_dev_is_mpath_component are not used for obtaining the device list, but they still use libudev for device info. When there are problems with udev, these functions can get stuck. So, use the existing obtain_device_list_from_udev config setting to also control whether these "is component" functions are used, which gives us a way to avoid using libudev entirely when it's causing problems.

---
 lib/device/dev-type.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
lib/device/dev-type.c +6 -0
index 33ebb73..e909c0f 100644
@@ -1063,6 +1063,9 @@ int udev_dev_is_mpath_component(struct device *dev)
 	const char *value;
 	int ret = 0;
 
+	if (!obtain_device_list_from_udev())
+		return 0;
+
 	if (!(udev_device = _udev_get_dev(dev)))
 		return 0;
 
@@ -1092,6 +1095,9 @@ int udev_dev_is_md_component(struct device *dev)
 	const char *value;
 	int ret = 0;
 
+	if (!obtain_device_list_from_udev())
+		return 0;
+
 	if (!(udev_device = _udev_get_dev(dev)))
 		return 0;