]> sourceware.org Git - lvm2.git/commitdiff
vgimportdevices: skip lvmlockd locking
authorDavid Teigland <teigland@redhat.com>
Mon, 25 Oct 2021 17:11:17 +0000 (12:11 -0500)
committerDavid Teigland <teigland@redhat.com>
Mon, 25 Oct 2021 17:11:17 +0000 (12:11 -0500)
Help bootstrapping existing shared vgs into the devices file.
Reading the vg in vgimportdevices would require locking to be
started, but vgchange lockstart won't see the vg if it's not
in the devices file.  The lvmlockd locks are not protecting
vg modifications so skipping them here won't be a problem.

tools/vgimportdevices.c

index 3f315f98f6a53936caeefc14c397990e47f3d28a..2580613c4aa94525cb515203aeda17ddd6a27c02 100644 (file)
@@ -172,6 +172,17 @@ int vgimportdevices(struct cmd_context *cmd, int argc, char **argv)
        cmd->filter_regex_with_devices_file = 1;
        cmd->create_edit_devices_file = 1;
 
+       /*
+        * This helps a user bootstrap existing shared VGs into the devices
+        * file. Reading the vg to import devices requires locking, but
+        * lockstart won't find the vg before it's in the devices file.
+        * So, allow importing devices without an lvmlockd lock (in a
+        * a shared vg the vg metadata won't be updated with device ids,
+        * so the lvmlockd lock isn't protecting vg modification.)
+        */
+       cmd->lockd_gl_disable = 1;
+       cmd->lockd_vg_disable = 1;
+
        /*
         * For each VG:
         * device_id_add() each PV in the VG
This page took 0.039611 seconds and 5 git commands to generate.