mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-23 10:50:34 +03:00
devices file: avoid updating entry dev names in some cases
Avoid thrashing changes to devices file device names by some commands that are run during startup when devnames are still being set up.
This commit is contained in:
parent
d3d6a0e820
commit
87714a1384
@ -194,6 +194,7 @@ struct cmd_context {
|
||||
unsigned sysinit:1; /* --sysinit is used */
|
||||
unsigned check_devs_used:1; /* check devs used by LVs */
|
||||
unsigned print_device_id_not_found; /* print devices file entries not found */
|
||||
unsigned ignore_device_name_mismatch; /* skip updating devices file names */
|
||||
|
||||
/*
|
||||
* Devices and filtering.
|
||||
|
@ -1639,6 +1639,15 @@ void device_ids_validate(struct cmd_context *cmd, struct dm_list *scanned_devs,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Avoid thrashing changes to the devices file during
|
||||
* startup due to device names that are still being
|
||||
* established. Commands that may run during startup
|
||||
* should set this flag.
|
||||
*/
|
||||
if (cmd->ignore_device_name_mismatch)
|
||||
continue;
|
||||
|
||||
if (!du->devname || strcmp(dev_name(du->dev), du->devname)) {
|
||||
log_warn("Device %s has updated name (devices file %s)",
|
||||
dev_name(du->dev), du->devname ?: "none");
|
||||
|
@ -1535,6 +1535,7 @@ int lvchange_activate_cmd(struct cmd_context *cmd, int argc, char **argv)
|
||||
init_background_polling(arg_is_set(cmd, sysinit_ARG) ? 0 : arg_int_value(cmd, poll_ARG, DEFAULT_BACKGROUND_POLLING));
|
||||
cmd->handles_missing_pvs = 1;
|
||||
cmd->lockd_vg_default_sh = 1;
|
||||
cmd->ignore_device_name_mismatch = 1;
|
||||
|
||||
/*
|
||||
* Include foreign VGs that contain active LVs.
|
||||
@ -1619,6 +1620,7 @@ int lvchange_refresh_cmd(struct cmd_context *cmd, int argc, char **argv)
|
||||
init_background_polling(arg_is_set(cmd, sysinit_ARG) ? 0 : arg_int_value(cmd, poll_ARG, DEFAULT_BACKGROUND_POLLING));
|
||||
cmd->handles_missing_pvs = 1;
|
||||
cmd->lockd_vg_default_sh = 1;
|
||||
cmd->ignore_device_name_mismatch = 1;
|
||||
|
||||
return process_each_lv(cmd, argc, argv, NULL, NULL, 0,
|
||||
NULL, &_lvchange_refresh_check, &_lvchange_refresh_single);
|
||||
@ -1792,6 +1794,7 @@ int lvchange_monitor_poll_cmd(struct cmd_context *cmd, int argc, char **argv)
|
||||
{
|
||||
init_background_polling(arg_is_set(cmd, sysinit_ARG) ? 0 : arg_int_value(cmd, poll_ARG, DEFAULT_BACKGROUND_POLLING));
|
||||
cmd->handles_missing_pvs = 1;
|
||||
cmd->ignore_device_name_mismatch = 1;
|
||||
return process_each_lv(cmd, argc, argv, NULL, NULL, 0,
|
||||
NULL, &_lvchange_monitor_poll_check, &_lvchange_monitor_poll_single);
|
||||
}
|
||||
|
@ -1622,6 +1622,8 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
|
||||
|
||||
cmd->print_device_id_not_found = 0;
|
||||
|
||||
cmd->ignore_device_name_mismatch = 1;
|
||||
|
||||
event_activation = find_config_tree_bool(cmd, global_event_activation_CFG, NULL);
|
||||
|
||||
if (do_activate && !event_activation) {
|
||||
|
@ -799,6 +799,9 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
|
||||
if (!update || !update_partial_unsafe)
|
||||
cmd->handles_missing_pvs = 1;
|
||||
|
||||
if (noupdate)
|
||||
cmd->ignore_device_name_mismatch = 1;
|
||||
|
||||
/*
|
||||
* Include foreign VGs that contain active LVs.
|
||||
* That shouldn't happen in general, but if it does by some
|
||||
|
Loading…
x
Reference in New Issue
Block a user