main - device_id: fix search on filtered device
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fee39370020424234bee1295cac480afeef72fd6 Commit: fee39370020424234bee1295cac480afeef72fd6 Parent: 8e61c0ad6ecad5e0bcee09e44029e39396c1b59a Author: David Teigland <[email protected]> AuthorDate: Tue Nov 16 09:29:24 2021 -0600 Committer: David Teigland <[email protected]> CommitterDate: Tue Nov 16 09:29:24 2021 -0600
device_id: fix search on filtered device
When devnames are used as device ids and devnames change, then new devices need to be located for the PVs. If the old devname is now used by a filtered device, this was preventing the code from searching for the new device, so the PV was reported as missing.
--- lib/device/device_id.c | 16 +++++++-- test/shell/devicesfile-devname.sh | 69 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 2 deletions(-)
lib/device/device_id.c +14 -2
@@ -2031,12 +2031,19 @@ void device_ids_find_renamed_devs(struct cmd_context *cmd, struct dm_list *dev_l search_auto = !strcmp (cmd->search_for_devnames,"auto" ); dm_list_iterate_items(du, &cmd->use_devices) { -if (du->dev) -continue ;if (!du->pvid)continue ;if (du->idtype !=DEV_ID_TYPE_DEVNAME )continue ; + +/* +* if the old incorrect devname is now a device that's +* filtered and not scanned, e.g. an mpath component, +* then we want to look for the pvid on a new device. +*/ +if (du->dev && !du->dev->filtered_flags) +continue ; +if (!(dil =dm_pool_zalloc (cmd->mem,sizeof (*dil))))continue ;
@@ -2061,6 +2068,11 @@ void device_ids_find_renamed_devs(struct cmd_context *cmd, struct dm_list *dev_l* the searched file, so a subsequent lvm command will do the search * again. In future perhaps we could add a policy to automatically * remove a devices file entry that's not been found for some time. +* +* TODO: like the hint file, add a hash of all devnames to the searched +* file so it can be ignored and removed if the devs/hash change. +* If hints are enabled, the hints invalidation could also remove the +* searched file. */ if (_searched_devnames_exists (cmd)) {log_debug ("Search for PVIDs skipped for %s" , _searched_file);
test/shell/devicesfile-devname.sh +69 -0
73 lines not on this page · raw message