master - use exclusive file lock on VG for activation
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=616eeba6f2b33640534e26dea43661724edf3a14 Commit: 616eeba6f2b33640534e26dea43661724edf3a14 Parent: e7aa51c70f17af10df906a7e123a497c1cf3c1ba Author: David Teigland <[email protected]> AuthorDate: Wed Jun 6 11:14:39 2018 -0500 Committer: Joe Thornber <[email protected]> CommitterDate: Thu Jun 7 16:17:04 2018 +0100
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.
--- tools/lvchange.c | 2 +- tools/pvscan.c | 2 +- tools/vgchange.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
tools/lvchange.c +1 -1
@@ -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 )
tools/pvscan.c +1 -1
@@ -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);
tools/vgchange.c +1 -1
@@ -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 ))) {