diff --git a/conf/example.conf.in b/conf/example.conf.in index cb4d3e5e1..2032a8145 100644 --- a/conf/example.conf.in +++ b/conf/example.conf.in @@ -697,6 +697,13 @@ activation { # # read_only_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ] + # Each LV can have an 'activation skip' flag stored persistently against it. + # During activation, this flag is used to decide whether such an LV is skipped. + # The 'activation skip' flag can be set during LV creation and by default it + # is automatically set for thin snapshot LVs. The 'auto_set_activation_skip' + # enables or disables this automatic setting of the flag while LVs are created. + # auto_set_activation_skip = 1 + # For RAID or 'mirror' segment types, 'raid_region_size' is the # size (in kiB) of each: # - synchronization operation when initializing diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index 2c4a69855..b284ce549 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -342,6 +342,8 @@ static int _process_config(struct cmd_context *cmd) cmd->default_settings.activation = find_config_tree_bool(cmd, global_activation_CFG, NULL); set_activation(cmd->default_settings.activation); + cmd->auto_set_activation_skip = find_config_tree_bool(cmd, activation_auto_set_activation_skip_CFG, NULL); + cmd->default_settings.suffix = find_config_tree_bool(cmd, global_suffix_CFG, NULL); if (!(cmd->default_settings.unit_factor = diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h index 2d90138ed..cd9160547 100644 --- a/lib/commands/toolcontext.h +++ b/lib/commands/toolcontext.h @@ -87,6 +87,7 @@ struct cmd_context { unsigned handles_unknown_segments:1; unsigned use_linear_target:1; unsigned partial_activation:1; + unsigned auto_set_activation_skip:1; unsigned si_unit_consistency:1; unsigned metadata_read_only:1; unsigned threaded:1; /* Set if running within a thread e.g. clvmd */ diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h index d9112f5e0..d2a67650f 100644 --- a/lib/config/config_settings.h +++ b/lib/config/config_settings.h @@ -185,6 +185,7 @@ cfg_array(activation_mlock_filter_CFG, "mlock_filter", activation_CFG_SECTION, 0 cfg(activation_use_mlockall_CFG, "use_mlockall", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_USE_MLOCKALL, vsn(2, 2, 62), NULL) cfg(activation_monitoring_CFG, "monitoring", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_DMEVENTD_MONITOR, vsn(2, 2, 63), NULL) cfg(activation_polling_interval_CFG, "polling_interval", activation_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_INTERVAL, vsn(2, 2, 63), NULL) +cfg(activation_auto_set_activation_skip_CFG, "auto_set_activation_skip", activation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_AUTO_SET_ACTIVATION_SKIP, vsn(2,2,99), NULL) cfg(metadata_pvmetadatacopies_CFG, "pvmetadatacopies", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_INT, DEFAULT_PVMETADATACOPIES, vsn(1, 0, 0), NULL) cfg(metadata_vgmetadatacopies_CFG, "vgmetadatacopies", metadata_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_INT, DEFAULT_VGMETADATACOPIES, vsn(2, 2, 69), NULL) diff --git a/lib/config/defaults.h b/lib/config/defaults.h index 7ee89ec2f..a789a9cfd 100644 --- a/lib/config/defaults.h +++ b/lib/config/defaults.h @@ -140,6 +140,7 @@ # define DEFAULT_ACTIVATION 0 #endif +#define DEFAULT_AUTO_SET_ACTIVATION_SKIP 1 #define DEFAULT_USE_LINEAR_TARGET 1 #define DEFAULT_STRIPE_FILLER "error" #define DEFAULT_RAID_REGION_SIZE 512 /* KB */ diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 1dc1529c8..ee6533207 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -5286,16 +5286,17 @@ static struct logical_volume *_create_virtual_origin(struct cmd_context *cmd, void lv_set_activation_skip(struct logical_volume *lv, int override_default, int add_skip) { - int skip; + int skip = 0; /* override default behaviour */ if (override_default) skip = add_skip; /* default behaviour */ - else if (lv_is_thin_volume(lv) && first_seg(lv)->origin) - skip = 1; /* skip activation for thin snapshots by default */ - else - skip = 0; + else if (lv->vg->cmd->auto_set_activation_skip) { + /* skip activation for thin snapshots by default */ + if (lv_is_thin_volume(lv) && first_seg(lv)->origin) + skip = 1; + } if (skip) lv->status |= LV_ACTIVATION_SKIP;