From bc10f60bdc1076b8b3405e9ce18a088cd770b268 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 13 Mar 2019 14:39:13 +0800 Subject: [PATCH 11/17] 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c index af4b407..e1671fa 100644 --- a/lib/device/dev-type.c +++ b/lib/device/dev-type.c @@ -1016,6 +1016,9 @@ int udev_dev_is_mpath_component(struct device *dev) unsigned i = 0; int ret = 0; + if (!obtain_device_list_from_udev()) + return 0; + if (!udev_context) { log_warn("WARNING: No udev context available to check if device %s is multipath component.", dev_name(dev)); return 0; -- 2.19.1