summaryrefslogtreecommitdiff
path: root/tools/vgchange.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/vgchange.c')
-rw-r--r--tools/vgchange.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 80d91c647..3e22b09df 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -665,8 +665,45 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
return ret;
}
+/*
+ * vgchange can do a different things that require different
+ * locking, so look at each of those things here.
+ *
+ * Set up overrides for the default VG locking for various special cases.
+ * The VG lock will be acquired in process_each_vg.
+ *
+ * Acquire the gl lock according to which kind of vgchange command this is.
+ */
+
static int dlock_vgchange(struct cmd_context *cmd, int argc, char **argv)
{
+ /* The default vg lock mode is ex, but these options only need sh. */
+
+ if (arg_is_set(cmd, activate_ARG) || arg_is_set(cmd, refresh_ARG))
+ cmd->command->flags |= DLOCK_VG_SH;
+
+ /* Starting a vg lockspace means there are no locks available yet. */
+
+ if (arg_is_set(cmd, lockstart_ARG))
+ cmd->disable_dlock_vg = 1;
+
+ /*
+ * In most cases, dlock_vg does not apply when changing lock type.
+ * (We don't generally allow changing *from* dlock type yet.)
+ * dlock_vg could be called within _vgchange_locktype as needed.
+ */
+
+ if (arg_is_set(cmd, locktype_ARG))
+ cmd->disable_dlock_vg = 1;
+
+ /*
+ * Changing system_id or lock_type must only be done on explicitly
+ * named vgs.
+ */
+
+ if (arg_is_set(cmd, systemid_ARG) || arg_is_set(cmd, locktype_ARG))
+ cmd->command->flags &= ~ALL_VGS_IS_DEFAULT;
+
if (!argc || arg_tag_count(argc, argv) || arg_is_set(cmd, lockstart_ARG)) {
/*
* The first two standard conditions want the current