summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2021-10-25 12:11:17 -0500
committerDavid Teigland <teigland@redhat.com>2021-12-20 14:22:17 -0600
commit074fce5c73c55e7a1547d5efff65a9f96e6db3b1 (patch)
tree1ae3519e46d8f8596a8884d6652262cb1c4237d5
parenta5a2d5fa1ec47a5a548db4cf435dc84de7ce7c31 (diff)
downloadlvm2-074fce5c73c55e7a1547d5efff65a9f96e6db3b1.tar.gz
vgimportdevices: skip lvmlockd locking
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.
-rw-r--r--tools/vgimportdevices.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/vgimportdevices.c b/tools/vgimportdevices.c
index 3f315f98f..2580613c4 100644
--- a/tools/vgimportdevices.c
+++ b/tools/vgimportdevices.c
@@ -173,6 +173,17 @@ int vgimportdevices(struct cmd_context *cmd, int argc, char **argv)
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
* update device_ids in the VG (potentially)