[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] master - lvm_init: don't use name mangling for LVM



Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1c4fe47308e3638b95f042a1efc942c5ce8e4fdc
Commit:        1c4fe47308e3638b95f042a1efc942c5ce8e4fdc
Parent:        b2da0f0a5b5b99c10c2ea531b63a3d9466eb1832
Author:        Peter Rajnoha <prajnoha redhat com>
AuthorDate:    Thu May 22 09:56:44 2014 +0200
Committer:     Peter Rajnoha <prajnoha redhat com>
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(-)

diff --git a/WHATS_NEW b/WHATS_NEW
index 61753d6..491dece 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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.
diff --git a/liblvm/lvm_base.c b/liblvm/lvm_base.c
index 2a373ba..47ad241 100644
--- a/liblvm/lvm_base.c
+++ b/liblvm/lvm_base.c
@@ -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 */
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 96e478f..66f691e 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]