1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-08-02 04:22:02 +03:00

device_id: fix conditions for device_ids_refresh

Fix commit 847f1dd99c
"device_id: rewrite validation of devname entries"

which began calling device_ids_refresh() in cases where it
was unnecessary, leading to extra PV searches and warnings.
Specifically, a command like "lvs <vg>" would use the hints
file to scan only devices for the named VG.  This means that
scanning other PVs would be skipped, and device IDs of those
PVs could not be validated because there are no PVID values
to verify.  This missing info would cause messages about
the missing info, and would cause device_ids_refresh to
search for the PVs that had been intentionally skipped.
This commit is contained in:
David Teigland
2023-10-05 15:22:32 -05:00
parent bccfd92f4a
commit 1901a47df1
6 changed files with 82 additions and 77 deletions

View File

@ -1256,7 +1256,6 @@ int label_scan(struct cmd_context *cmd)
struct device_list *devl, *devl2;
struct device *dev;
uint64_t max_metadata_size_bytes;
int device_ids_invalid = 0;
int using_hints;
int create_hints = 0; /* NEWHINTS_NONE */
@ -1458,7 +1457,7 @@ int label_scan(struct cmd_context *cmd)
* Check if the devices_file content is up to date and
* if not update it.
*/
device_ids_validate(cmd, &scan_devs, &device_ids_invalid, 0);
device_ids_validate(cmd, &scan_devs, 0);
dm_list_iterate_items_safe(devl, devl2, &all_devs) {
dm_list_del(&devl->list);
@ -1494,7 +1493,7 @@ int label_scan(struct cmd_context *cmd)
* (create_hints variable has NEWHINTS_X value which indicates
* the reason for creating the new hints.)
*/
if (create_hints && !device_ids_invalid)
if (create_hints && !cmd->device_ids_invalid)
write_hint_file(cmd, create_hints);
return 1;