Skip to contentSkip to conversation

main - vdo: support online rename

PATCH Zdenek Kabelac 1 participant 1 message Jan 22, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8532b1ca97e8b9b4a9250140b5d629169f36df28
Commit:        8532b1ca97e8b9b4a9250140b5d629169f36df28
Parent:        4b8e5ad595aefb6e3e389051b9a374cc0d1a02a5
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Thu Jan 21 21:18:05 2021 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Jan 22 15:30:37 2021 +0100

vdo: support online rename

New VDO targets v6.2.3 corrects support for online rename of VDO device. If needed if can be disable via new lvm.conf setting:

vdo_disabled_features = [ "online_rename" ]

---
 conf/example.conf.in         | 10 ++++++++++
 lib/config/config_settings.h |  9 +++++++++
 lib/metadata/lv_manip.c      | 14 +++++++++++---
 lib/metadata/segtype.h       |  2 ++
 lib/vdo/vdo.c                | 46 ++++++++++++++++++++++++++++++++++++--------
 5 files changed, 70 insertions(+), 11 deletions(-)
conf/example.conf.in +10 -0
index c32f4f5ad..8f6546165 100644
@@ -1194,6 +1194,16 @@ global {
 	# This configuration option has an automatic default value.
 	# vdo_format_options = [ "" ]
 
+	# Configuration option global/vdo_disabled_features.
+	# Features to not use in the vdo driver.
+	# This can be helpful for testing, or to avoid using a feature that is
+	# causing problems. Features include: online_rename
+	#
+	# Example
+	# vdo_disabled_features = [ "online_rename" ]
+	#
+	# This configuration option does not have a default value defined.
+
 	# Configuration option global/fsadm_executable.
 	# The full path to the fsadm command.
 	# LVM uses this command to help with lvresize -r operations.
lib/config/config_settings.h +9 -0
index 163e01485..5fc931de6 100644
@@ -1206,6 +1206,15 @@ cfg(global_vdo_format_executable_CFG, "vdo_format_executable", global_CFG_SECTIO
 cfg_array(global_vdo_format_options_CFG, "vdo_format_options", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_VDO_FORMAT_OPTIONS_CONFIG, VDO_1ST_VSN, NULL, 0, NULL,
 	"List of options passed added to standard vdoformat command.\n")
 
+cfg_array(global_vdo_disabled_features_CFG, "vdo_disabled_features", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 3, 11), NULL, 0, NULL,
+	"Features to not use in the vdo driver.\n"
+	"This can be helpful for testing, or to avoid using a feature that is\n"
+	"causing problems. Features include: online_rename\n"
+	"#\n"
+	"Example\n"
+	"vdo_disabled_features = [ \"online_rename\" ]\n"
+	"#\n")
+
 cfg(global_fsadm_executable_CFG, "fsadm_executable", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_FSADM_PATH, vsn(2, 2, 170), "@FSADM_PATH@", 0, NULL,
 	"The full path to the fsadm command.\n"
 	"LVM uses this command to help with lvresize -r operations.\n")
lib/metadata/lv_manip.c +11 -3
index c740ba2bd..6c7126378 100644
@@ -4738,6 +4738,8 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
 	struct lv_names lv_names = { .old = lv->name };
 	int old_lv_is_historical = lv_is_historical(lv);
 	int historical;
+	unsigned attrs;
+	const struct segment_type *segtype;
 
 	/*
 	 * rename is not allowed on sub LVs except for pools
@@ -4763,9 +4765,15 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
 	}
 
 	if (lv_is_vdo_pool(lv) && lv_is_active(lv_lock_holder(lv))) {
-		log_error("Cannot rename active VDOPOOL volume %s.",
-			  display_lvname(lv));
-		return 0;
+		segtype = first_seg(lv)->segtype;
+		if (!segtype->ops->target_present ||
+		    !segtype->ops->target_present(lv->vg->cmd, NULL, &attrs) ||
+		    !(attrs & VDO_FEATURE_ONLINE_RENAME)) {
+			log_error("Cannot rename active VDOPOOL volume %s, "
+				  "VDO target feature support is missing.",
+				  display_lvname(lv));
+			return 0;
+		}
 	}
 
 	if (update_mda && !archive(vg))
lib/metadata/segtype.h +2 -0
index 08ddc3565..2714a6b45 100644
@@ -349,6 +349,8 @@ int init_cache_segtypes(struct cmd_context *cmd, struct segtype_library *seglib)
 int init_vdo_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
 #endif
 
+#define VDO_FEATURE_ONLINE_RENAME		(1U << 0) /* version 6.2.3 */
+
 int init_writecache_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
 
 int init_integrity_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
lib/vdo/vdo.c +38 -8

92 lines not on this page · raw message