summaryrefslogtreecommitdiff
path: root/tools/pvscan.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2021-06-08 17:12:09 -0500
committerDavid Teigland <teigland@redhat.com>2021-07-13 11:11:23 -0500
commit90485650931d3fc04d00c92a729050c8743969e5 (patch)
treee7b17771fba2aeba3fa9415a68524022ca30d60d /tools/pvscan.c
parentdb22a389cfb12eef77dfc2e1ce124ac83ed6c5a2 (diff)
downloadlvm2-90485650931d3fc04d00c92a729050c8743969e5.tar.gz
devices: rework libudev usage
related to config settings: obtain_device_info_from_udev (controls if lvm gets a list of devices from readdir /dev or from libudev) external_device_info_source (controls if lvm asks libudev for device information) . Make the obtain_device_list_from_udev setting affect only the choice of readdir /dev vs libudev. The setting no longer controls if udev is used for device type checks. . Change obtain_device_list_from_udev default to 0. This helps avoid boot timeouts due to slow libudev queries, avoids reported failures from udev_enumerate_scan_devices, and avoids delays from "device not initialized in udev database" errors. Even without errors, for a system booting with 1024 PVs, lvm2-pvscan times improve from about 100 sec to 15 sec, and the pvscan command from about 64 sec to about 4 sec. . For external_device_info_source="none", remove all libudev device info queries, and use only lvm native device info. . For external_device_info_source="udev", first check lvm native device info, then check libudev info. . Remove sleep/retry loop when attempting libudev queries for device info. udev info will simply be skipped if it's not immediately available. . Only set up a libdev connection if it will be used by obtain_device_list_from_udev/external_device_info_source. . For native multipath component detection, use /etc/multipath/wwids. If a device has a wwid matching an entry in the wwids file, then it's considered a multipath component. This is necessary to natively detect multipath components when the mpath device is not set up.
Diffstat (limited to 'tools/pvscan.c')
-rw-r--r--tools/pvscan.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 464501ad5..40a93957c 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -1193,16 +1193,6 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs
log_debug("online_devs %s %s", dev_name(dev), dev->pvid);
- /*
- * This should already have been done by the filter, but make
- * another check directly with udev in case the filter was not
- * using udev and the native version didn't catch it.
- */
- if (udev_dev_is_mpath_component(dev)) {
- log_print("pvscan[%d] ignore multipath component %s.", getpid(), dev_name(dev));
- continue;
- }
-
if (!(info = lvmcache_info_from_pvid(dev->pvid, dev, 0))) {
if (!do_all)
log_print("pvscan[%d] ignore %s with no lvm info.", getpid(), dev_name(dev));
@@ -1257,7 +1247,7 @@ static int _online_devs(struct cmd_context *cmd, int do_all, struct dm_list *pvs
if (pv->device_hint && !strncmp(pv->device_hint, "/dev/md", 7))
do_full_check = 1;
}
- if (do_full_check && dev_is_md_component(dev, NULL, 1)) {
+ if (do_full_check && dev_is_md_component(cmd, dev, NULL, 1)) {
log_print("pvscan[%d] ignore md component %s.", getpid(), dev_name(dev));
release_vg(vg);
continue;