]> sourceware.org Git - lvm2.git/commitdiff
use exclusive file lock on VG for activation
authorDavid Teigland <teigland@redhat.com>
Wed, 6 Jun 2018 16:14:39 +0000 (11:14 -0500)
committerJoe Thornber <ejt@redhat.com>
Thu, 7 Jun 2018 15:17:04 +0000 (16:17 +0100)
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
tools/pvscan.c
tools/vgchange.c

index a90174e4de381fecc7609e80f86e0dd77d4e398a..3ed6b064081f3fc0971c338d40671942202d9bf1 100644 (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)
index 7cba0f44a956d1e4f9e302ec85757f7f37ee0fc8..61626e6b1200afa524f602ed07da5b79b71bac39 100644 (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);
 
index a67c3be927078052b6df333d1c62adc5868303df..b07057f99d5555dd78fb8082b8ce674016704101 100644 (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))) {
This page took 0.047602 seconds and 5 git commands to generate.