summaryrefslogtreecommitdiff
path: root/lib/cache
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2022-10-31 16:14:01 -0500
committerDavid Teigland <teigland@redhat.com>2022-11-07 08:56:02 -0600
commit761b922178c8522fd9abb207ba31bd27f9fa9dc4 (patch)
treeab046fbf52366d16b248a9ff2b6b0f492e233f16 /lib/cache
parentbdab36cf3f059e597371bb504646f4dfb7a89f50 (diff)
downloadlvm2-761b922178c8522fd9abb207ba31bd27f9fa9dc4.tar.gz
device_id: handle duplicate serial numbers
Handle multiple devices using the same serial number as their device id. After matching devices to devices file entries, if there is a discrepency between the ondisk PVID and the devices file PVID, then rematch devices to devices file entries using PVID, looking at all disks on the system with the same serial number.
Diffstat (limited to 'lib/cache')
-rw-r--r--lib/cache/lvmcache.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 2cb904fd4..1aa699c83 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -1635,6 +1635,22 @@ int lvmcache_label_scan(struct cmd_context *cmd)
return_0;
/*
+ * device_ids_validate() found devices using a sys_serial device id
+ * which had a PVID on disk that did not match the PVID in the devices
+ * file. Serial numbers may not always be unique, so any device with
+ * the same serial number is found and searched for the correct PVID.
+ * If the PVID is found on a device that has not been scanned, then
+ * it needs to be scanned so it can be used.
+ */
+ if (!dm_list_empty(&cmd->device_ids_check_serial)) {
+ struct dm_list scan_devs;
+ dm_list_init(&scan_devs);
+ device_ids_check_serial(cmd, &scan_devs, NULL, 0);
+ if (!dm_list_empty(&scan_devs))
+ label_scan_devs(cmd, cmd->filter, &scan_devs);
+ }
+
+ /*
* When devnames are used as device ids (which is dispreferred),
* changing/unstable devnames can lead to entries in the devices file
* not being matched to a dev even if the PV is present on the system.