All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/PATCH] Give --persistent_policy precedence over /dev/mapper names
@ 2016-10-05 12:13 Martin Wilck
       [not found] ` <20161005121303.31582-1-mwilck-l3A5Bk7waGM@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Wilck @ 2016-10-05 12:13 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA; +Cc: Martin Wilck

There is currently no way to override dracut's preference for
/dev/mapper device names. But using these is problematic in
different scenarios: For example, if a user has a multipath-
enabled system but wants to disable multipath, or if the
names of multipath maps change because of configuration changes
(e.g. toggling user_friendly_names in /etc/multipath.conf).

This patch makes dracut prefer the user-specified
--persistent_policy names over /dev/mapper names.

It might be worthwhile to discuss why dracut prefers /dev/mapper
of /dev/disk/by-uuid at all. This preference was introduced
in 9037b63e with the argument "dm devices maintain /dev/mapper/* as
persistent names", but that's wrong for the scenarios mentioned
above, and is not a compelling reason for preferring /dev/mapper
over /dev/disk/by-uuid.

Signed-off-by: Martin Wilck <mwilck-l3A5Bk7waGM@public.gmane.org>
---
 dracut-functions.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dracut-functions.sh b/dracut-functions.sh
index 249d8fb..e97765d 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -223,14 +223,20 @@ get_devpath_block() {
 
 # get a persistent path from a device
 get_persistent_dev() {
-    local i _tmp _dev
+    local i _tmp _dev _pol
 
     _dev=$(get_maj_min "$1")
     [ -z "$_dev" ] && return
 
+    if [[ -n "$persistent_policy" ]]; then
+	_pol="/dev/disk/${persistent_policy}/*"
+    else
+	_pol=
+    fi
+
     for i in \
+        $_pol \
         /dev/mapper/* \
-        /dev/disk/${persistent_policy:-by-uuid}/* \
         /dev/disk/by-uuid/* \
         /dev/disk/by-label/* \
         /dev/disk/by-partuuid/* \
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-27  7:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-05 12:13 [RFC/PATCH] Give --persistent_policy precedence over /dev/mapper names Martin Wilck
     [not found] ` <20161005121303.31582-1-mwilck-l3A5Bk7waGM@public.gmane.org>
2016-10-17  9:18   ` Martin Wilck
2016-10-26 11:45   ` Harald Hoyer
     [not found]     ` <e8384369-a93f-63b1-9422-21c9d5bce657-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-27  7:18       ` Martin Wilck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.