diff options
author | David Teigland <teigland@redhat.com> | 2015-07-31 14:11:24 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2015-07-31 14:11:24 -0500 |
commit | 439a579aa2aaf13c2e420b6e7888dbd71d7021c0 (patch) | |
tree | 3fe4b77916a6f92972f788d24678289ebd6dda30 | |
parent | 649c9d47199feddf7f5b65b5dbe12918ba2b383b (diff) | |
download | lvm2-439a579aa2aaf13c2e420b6e7888dbd71d7021c0.tar.gz |
vgchange/lvchange: allow deactivation without locking
If locking with lvmlockd has failed, allow LVs to be deactivated.
-rw-r--r-- | tools/lvchange.c | 4 | ||||
-rw-r--r-- | tools/vgchange.c | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/tools/lvchange.c b/tools/lvchange.c index 823c36aab..22a407aea 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -1296,7 +1296,9 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv) */ if (arg_count(cmd, activate_ARG) || arg_count(cmd, refresh_ARG)) { cmd->lockd_vg_default_sh = 1; - cmd->lockd_vg_enforce_sh = 1; + /* Allow deactivating if locks fail. */ + if (is_change_activating((activation_change_t)arg_uint_value(cmd, activate_ARG, CHANGE_AY))) + cmd->lockd_vg_enforce_sh = 1; } return process_each_lv(cmd, argc, argv, diff --git a/tools/vgchange.c b/tools/vgchange.c index a163cf584..7aecd980d 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -204,7 +204,7 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg, if (vg->system_id && vg->system_id[0] && cmd->system_id && cmd->system_id[0] && strcmp(vg->system_id, cmd->system_id) && - is_change_activating(activate)) { + do_activate) { log_error("Cannot activate LVs in a foreign VG."); return ECMD_FAILED; } @@ -1026,7 +1026,9 @@ static int _lockd_vgchange(struct cmd_context *cmd, int argc, char **argv) if (arg_is_set(cmd, activate_ARG) || arg_is_set(cmd, refresh_ARG)) { cmd->lockd_vg_default_sh = 1; - cmd->lockd_vg_enforce_sh = 1; + /* Allow deactivating if locks fail. */ + if (is_change_activating((activation_change_t)arg_uint_value(cmd, activate_ARG, CHANGE_AY))) + cmd->lockd_vg_enforce_sh = 1; } /* Starting a vg lockspace means there are no locks available yet. */ |