summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2019-07-22 12:12:42 -0500
committerDavid Teigland <teigland@redhat.com>2019-07-22 12:22:12 -0500
commit3d980172b076547865efe5ca0839cabedc05a7b9 (patch)
treebf2189d7b02151b4e326a65825fccdee640739ab
parente3c8cebd87f9bd7591529f3d65783cc6f1fd3f92 (diff)
downloadlvm2-3d980172b076547865efe5ca0839cabedc05a7b9.tar.gz
vgrename: use global lock
Should fix a reported problem of pvs seeing bad orphan info while vgrename was running.
-rw-r--r--tools/vgrename.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/vgrename.c b/tools/vgrename.c
index 4f2a08bb6..f13289e53 100644
--- a/tools/vgrename.c
+++ b/tools/vgrename.c
@@ -202,6 +202,11 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
if (!(vp.vg_name_new = dm_pool_strdup(cmd->mem, vg_name_new)))
return_ECMD_FAILED;
+ if (!lock_vol(cmd, VG_GLOBAL, LCK_VG_WRITE, NULL)) {
+ log_error("Unable to obtain global lock.");
+ return_ECMD_FAILED;
+ }
+
/* Needed change the global VG namespace. */
if (!lockd_gl(cmd, "ex", LDGL_UPDATE_NAMES))
return_ECMD_FAILED;