summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2015-06-01 11:39:50 -0500
committerDavid Teigland <teigland@redhat.com>2015-06-01 11:39:50 -0500
commit169c5cab65d97770a427d4613a7be6021d9c5b6b (patch)
treef8301c02a6e844ebeb123dc403f506e97b5217e3
parent8ee601e20ebbfde99d845de18d4219b8db60329d (diff)
downloadlvm2-169c5cab65d97770a427d4613a7be6021d9c5b6b.tar.gz
lib lvmlockd: print a warning when overriding locking
In addition to requiring lvm.conf configuration to override lock modes, also print a warning if it is done.
-rw-r--r--lib/locking/lvmlockd.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 4c528c510..49ab40c38 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -1086,13 +1086,16 @@ int lockd_gl_create(struct cmd_context *cmd, const char *def_mode, const char *v
uint32_t lockd_flags;
int result;
+ /* A specific lock mode was given on the command line. */
if (cmd->lock_gl_mode) {
mode = cmd->lock_gl_mode;
- if (mode && def_mode && strcmp(mode, "enable") &&
- (_mode_compare(mode, def_mode) < 0) &&
- !find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
- log_error("Disallowed lock-gl mode \"%s\"", mode);
- return 0;
+ if (mode && def_mode && strcmp(mode, "enable") && (_mode_compare(mode, def_mode) < 0)) {
+ if (!find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
+ log_error("Disallowed lock-gl mode \"%s\"", mode);
+ return 0;
+ } else {
+ log_warn("WARNING: overriding default global lock mode.");
+ }
}
}
@@ -1266,13 +1269,16 @@ int lockd_gl(struct cmd_context *cmd, const char *def_mode, uint32_t flags)
uint32_t lockd_flags;
int result;
+ /* A specific lock mode was given on the command line. */
if (!(flags & LDGL_MODE_NOARG) && cmd->lock_gl_mode) {
mode = cmd->lock_gl_mode;
- if (mode && def_mode &&
- (_mode_compare(mode, def_mode) < 0) &&
- !find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
- log_error("Disallowed lock-gl mode \"%s\"", mode);
- return 0;
+ if (mode && def_mode && (_mode_compare(mode, def_mode) < 0)) {
+ if (!find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
+ log_error("Disallowed lock-gl mode \"%s\"", mode);
+ return 0;
+ } else {
+ log_warn("WARNING: overriding default global lock mode.");
+ }
}
}
@@ -1470,15 +1476,18 @@ int lockd_vg(struct cmd_context *cmd, const char *vg_name, const char *def_mode,
*lockd_state = 0;
/*
+ * A specific lock mode was given on the command line.
* LDVG_MODE_NOARG disables getting the mode from --lock-vg arg.
*/
if (!(flags & LDVG_MODE_NOARG) && cmd->lock_vg_mode) {
mode = cmd->lock_vg_mode;
- if (mode && def_mode &&
- (_mode_compare(mode, def_mode) < 0) &&
- !find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
- log_error("Disallowed lock-vg mode \"%s\"", mode);
- return 0;
+ if (mode && def_mode && (_mode_compare(mode, def_mode) < 0)) {
+ if (!find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
+ log_error("Disallowed lock-vg mode \"%s\"", mode);
+ return 0;
+ } else {
+ log_warn("WARNING: overriding default VG lock mode.");
+ }
}
}
@@ -1721,10 +1730,14 @@ int lockd_lv_name(struct cmd_context *cmd, struct volume_group *vg,
return 0;
}
- if (cmd->lock_lv_mode && (_mode_compare(cmd->lock_lv_mode, "sh") < 0) &&
- !find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
- log_error("Disallowed lock-lv mode \"%s\"", cmd->lock_lv_mode);
- return 0;
+ /* A specific lock mode was given on the command line. */
+ if (cmd->lock_lv_mode && (_mode_compare(cmd->lock_lv_mode, "sh") < 0)) {
+ if (!find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
+ log_error("Disallowed lock-lv mode \"%s\"", cmd->lock_lv_mode);
+ return 0;
+ } else {
+ log_warn("WARNING: overriding default LV lock mode.");
+ }
}
if (cmd->lock_lv_mode)