1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

use exclusive file lock on VG for activation

Make activation commands:
  vgchange -ay, lvchange -ay, pvscan -aay

take an exclusive file lock on the VG to serialize
multiple concurrent activation commands which could
otherwise interfere with each other.
This commit is contained in:
David Teigland 2018-06-06 11:14:39 -05:00
parent d2d8dd7f7f
commit 58a9254252
3 changed files with 3 additions and 3 deletions

View File

@ -1386,7 +1386,7 @@ int lvchange_activate_cmd(struct cmd_context *cmd, int argc, char **argv)
} else /* Component LVs might be active, support easy deactivation */
cmd->process_component_lvs = 1;
ret = process_each_lv(cmd, argc, argv, NULL, NULL, 0,
ret = process_each_lv(cmd, argc, argv, NULL, NULL, READ_FOR_UPDATE,
NULL, &_lvchange_activate_check, &_lvchange_activate_single);
if (ret != ECMD_PROCESSED)

View File

@ -288,7 +288,7 @@ static int _pvscan_autoactivate(struct cmd_context *cmd, struct pvscan_aa_params
pp->refresh_all = 1;
}
ret = process_each_vg(cmd, 0, NULL, NULL, vgnames, 0, 0, handle, _pvscan_autoactivate_single);
ret = process_each_vg(cmd, 0, NULL, NULL, vgnames, READ_FOR_UPDATE, 0, handle, _pvscan_autoactivate_single);
destroy_processing_handle(cmd, handle);

View File

@ -791,7 +791,7 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
cmd->lockd_vg_enforce_sh = 1;
}
if (update)
if (update || arg_is_set(cmd, activate_ARG))
flags |= READ_FOR_UPDATE;
if (!(handle = init_processing_handle(cmd, NULL))) {