summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2015-08-10 15:46:21 -0500
committerDavid Teigland <teigland@redhat.com>2015-08-10 15:46:21 -0500
commit53c08f0bba9f18df80403eab67acb032f3049902 (patch)
tree4cb54ed0512a92813bd676100afdc0558a15861d
parent597de9d58673f141bf21aa9db899d13ca2c97b7b (diff)
downloadlvm2-53c08f0bba9f18df80403eab67acb032f3049902.tar.gz
lvrename: fix lockd LV locking
lvrename should not be done if the LV is active on another host. This check was mistakenly removed when the code was changed to use LV uuids in locks rather than LV names.
-rw-r--r--lib/metadata/lv_manip.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 86411d5b2..b22773e5b 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4205,6 +4205,18 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
return 0;
}
+ /*
+ * The lvmlockd LV lock is only acquired here to ensure the LV is not
+ * active on another host. This requests a transient LV lock.
+ * If the LV is active, a persistent LV lock already exists in
+ * lvmlockd, and the transient lock request does nothing.
+ * If the LV is not active, then no LV lock exists and the transient
+ * lock request acquires the LV lock (or fails). The transient lock
+ * is automatically released when the command exits.
+ */
+ if (!lockd_lv(cmd, lv, "ex", 0))
+ return_0;
+
if (update_mda && !archive(vg))
return_0;