Skip to contentSkip to conversation

stable-2.02 - vgrename: use global lock

PATCH David Teigland 1 participant 1 message Jul 22, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3d980172b076547865efe5ca0839cabedc05a7b9
Commit:        3d980172b076547865efe5ca0839cabedc05a7b9
Parent:        e3c8cebd87f9bd7591529f3d65783cc6f1fd3f92
Author:        David Teigland <[email protected]>
AuthorDate:    Mon Jul 22 12:12:42 2019 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Mon Jul 22 12:22:12 2019 -0500

vgrename: use global lock

Should fix a reported problem of pvs seeing bad orphan info while vgrename was running.

---
 tools/vgrename.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
tools/vgrename.c +5 -0
index 4f2a08b..f13289e 100644
@@ -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;