summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2015-12-09 11:51:25 -0600
committerDavid Teigland <teigland@redhat.com>2015-12-09 11:59:49 -0600
commitbdba4e7a931f1e77f9c7cf6837a6c8b33b35a099 (patch)
tree8699c19a8acc82ae6704a368499479c1d0d41b3c
parentdcd946e95a80da1b6b2d2285d9a5f41e87cb153d (diff)
downloadlvm2-bdba4e7a931f1e77f9c7cf6837a6c8b33b35a099.tar.gz
lvrename: move the lvmlockd LV lock
The function it was in is used for various internal renaming of hidden LVs where a lock from lvmlockd does not apply.
-rw-r--r--lib/metadata/lv_manip.c12
-rw-r--r--tools/lvrename.c12
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 2582ed556..2f37f5b19 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4247,18 +4247,6 @@ 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;
diff --git a/tools/lvrename.c b/tools/lvrename.c
index 18b02d265..217ebdc40 100644
--- a/tools/lvrename.c
+++ b/tools/lvrename.c
@@ -46,6 +46,18 @@ static int _lvrename_single(struct cmd_context *cmd, const char *vg_name,
goto bad;
}
+ /*
+ * 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, lvl->lv, "ex", 0))
+ goto_bad;
+
if (!lv_rename(cmd, lvl->lv, lp->lv_name_new))
goto_bad;