master - vgchange/lvchange: allow deactivation without locking
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=439a579aa2aaf13c2e420b6e7888dbd71d7021c0 Commit: 439a579aa2aaf13c2e420b6e7888dbd71d7021c0 Parent: 649c9d47199feddf7f5b65b5dbe12918ba2b383b Author: David Teigland <[email protected]> AuthorDate: Fri Jul 31 14:11:24 2015 -0500 Committer: David Teigland <[email protected]> CommitterDate: Fri Jul 31 14:11:24 2015 -0500
vgchange/lvchange: allow deactivation without locking
If locking with lvmlockd has failed, allow LVs to be deactivated.
--- tools/lvchange.c | 4 +++- tools/vgchange.c | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-)
tools/lvchange.c +3 -1
@@ -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,
tools/vgchange.c +4 -2
@@ -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. */