Skip to contentSkip to conversation

master - lvm_init: don't use name mangling for LVM

PATCH Peter Rajnoha 1 participant 1 message May 22, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1c4fe47308e3638b95f042a1efc942c5ce8e4fdc
Commit:        1c4fe47308e3638b95f042a1efc942c5ce8e4fdc
Parent:        b2da0f0a5b5b99c10c2ea531b63a3d9466eb1832
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Thu May 22 09:56:44 2014 +0200
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Thu May 22 10:00:19 2014 +0200

lvm_init: don't use name mangling for LVM

LVM has restricter character set that is allowed for VG-LV names and the dm names constructed do not contain any blacklisted characters that would require name mangling.

Also, when any other device-mapper device is scanned that could possibly contain such blacklisted characters, we reference the device by its major:minor instead of dm name (e.g. _device_is_usable fn).

---
 WHATS_NEW          |    1 +
 liblvm/lvm_base.c  |    7 +++++++
 tools/lvmcmdline.c |    7 +++++++
 3 files changed, 15 insertions(+), 0 deletions(-)
WHATS_NEW +1 -0
index 61753d6..491dece 100644
@@ -1,5 +1,6 @@
 Version 2.02.107 - 
 ==================================
+  Don't use name mangling for LVM - it never uses dm names with wrong char set.
   Remove default.profile and add {command,metadata}_profile_template.profile.
   Use proper umask for systemd units generated by lvm2-activation-generator.
   Check for failing mirror_remove_missing() function.
liblvm/lvm_base.c +7 -0
index 2a373ba..47ad241 100644
@@ -35,6 +35,13 @@ static lvm_t _lvm_init(const char *system_dir)
 	if (!udev_init_library_context())
 		stack;
 
+	/*
+	 * It's not necessary to use name mangling for LVM:
+	 *   - the character set used for VG-LV names is subset of udev character set
+	 *   - when we check other devices (e.g. _device_is_usable fn), we use major:minor, not dm names
+	 */
+	dm_set_name_mangling_mode(DM_STRING_MANGLING_NONE);
+
 	/* create context */
 	/* FIXME: split create_toolcontext */
 	/* FIXME: make all globals configurable */
tools/lvmcmdline.c +7 -0
index 96e478f..66f691e 100644
@@ -1527,6 +1527,13 @@ struct cmd_context *init_lvm(void)
 	if (!udev_init_library_context())
 		stack;
 
+	/*
+	 * It's not necessary to use name mangling for LVM:
+	 *   - the character set used for LV names is subset of udev character set
+	 *   - when we check other devices (e.g. _device_is_usable fn), we use major:minor, not dm names
+	 */
+	dm_set_name_mangling_mode(DM_STRING_MANGLING_NONE);
+
 	if (!(cmd = create_toolcontext(0, NULL, 1, 0))) {
 		udev_fin_library_context();
 		return_NULL;