Skip to contentSkip to conversation

master - lv_rename: fix snapshot rename

PATCH Zdenek Kabelac 1 participant 1 message Sep 9, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=413fc9d3e699206ec493a70c6baf98bc87b83a9f
Commit:        413fc9d3e699206ec493a70c6baf98bc87b83a9f
Parent:        319f67b1abd8b391958c8cd6d396c590bb5225be
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Sep 9 18:47:27 2014 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Sep 9 19:15:24 2014 +0200

lv_rename: fix snapshot rename

Fix rename operation for snapshot (cow) LV.
Only the snapshot's origin has the lock and by mistake suspend and resume has been called for the snapshot LV.
This further made volumes unusable in cluster.

So instead of suspend and resuming list of LVs,
we need to just suspend and resume origin.

As the sequence write/suspend/commit/resume
is widely used in lvm2 code base - move it to
new lv_update_and_reload function.

---
 WHATS_NEW                        |    2 +
 lib/metadata/lv_manip.c          |   96 +++++++++++++++++++++----------------
 lib/metadata/metadata-exported.h |    4 ++
 3 files changed, 60 insertions(+), 42 deletions(-)
WHATS_NEW +2 -0
index bf929f6..2175d29 100644
@@ -1,5 +1,7 @@
 Version 2.02.112 - 
 =====================================
+  Introduce common code to modify metadate and reload updated LV.
+  Fix rename of active snapshot volume in cluster.
   Make sure shared libraries are built with RELRO option.
 
 Version 2.02.111 - 1st September 2014
lib/metadata/lv_manip.c +54 -42

121 lines not on this page · raw message

lib/metadata/metadata-exported.h +4 -0
index 0db4334..b0ca632 100644
@@ -700,6 +700,10 @@ int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
 int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
 		     const char *new_name, int update_mda);
 
+/* Updates and reloads metadata for given lv */
+int lv_update_and_reload(struct logical_volume *lv);
+int lv_update_and_reload_origin(struct logical_volume *lv);
+
 uint64_t extents_from_size(struct cmd_context *cmd, uint64_t size,
 			   uint32_t extent_size);