Skip to contentSkip to conversation

master - lockd: vgrename fixes

PATCH David Teigland 1 participant 1 message Sep 3, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=96dc03b33782cf0e33f5fdf57cd8eb475e4bd7c9
Commit:        96dc03b33782cf0e33f5fdf57cd8eb475e4bd7c9
Parent:        d1d00fdeec04b1c856dfbe2d1ad8914e0968acfb
Author:        David Teigland <[email protected]>
AuthorDate:    Thu Sep 3 10:21:44 2015 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Thu Sep 3 10:21:44 2015 -0500

lockd: vgrename fixes

If busy locks in lvmlockd prevent vgrename, use the correct error exit path, and print a user-friendly error message.

---
 lib/locking/lvmlockd.c |    6 ++++++
 tools/vgrename.c       |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)
lib/locking/lvmlockd.c +6 -0
index f3e2e2c..983ecc9 100644
@@ -2423,6 +2423,12 @@ int lockd_rename_vg_before(struct cmd_context *cmd, struct volume_group *vg)
 	}
 
 	daemon_reply_destroy(reply);
+
+	/* Other hosts have not stopped the lockspace. */
+	if (result == -EBUSY) {
+		log_error("Lockspace for \"%s\" not stopped on other hosts", vg->name);
+		return 0;
+	}
 	
 	if (!ret) {
 		log_error("lockd_rename_vg_before lvmlockd result %d", result);
tools/vgrename.c +1 -1
index 7e77b57..620345b 100644
@@ -150,7 +150,7 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
 		stack;
 
 	if (!lockd_rename_vg_before(cmd, vg))
-		return_0;
+		goto error;
 
 	/* Change the volume group name */
 	vg_rename(cmd, vg, vg_name_new);