Blame SOURCES/0364-multipath-fix-majmin_to_mpath_dev.patch

712866
From 851946468adf0bc80b9c66b10ae586449b51275f Mon Sep 17 00:00:00 2001
712866
From: Pekka Wallendahl <wyrmiyu@gmail.com>
712866
Date: Mon, 18 Jan 2016 20:28:22 +0200
712866
Subject: [PATCH] multipath: fix majmin_to_mpath_dev()
712866
712866
* Multipath device names only start with the mpath-prefix if the option
712866
  use_userfriendly_names is set true in /etc/multipath.conf and if user
712866
  has not set any aliases in the said file. Thus the for-loop should go
712866
  through all files in /dev/mapper/, not just ones starting with 'mpath'
712866
712866
* Bash is perfectly capable to extend `/dev/mapper/*` notation without a
712866
  need to pass it to an external ls
712866
712866
* Changed the function to use a local variable $_dev instead of the
712866
  global $dev, which seemed to be the original intention as the local
712866
  _dev was defined but not used
712866
712866
(cherry picked from commit 28058a2e373eb268d9b1cd5b65c2ad607961dad1)
712866
---
712866
 modules.d/90multipath/module-setup.sh | 7 ++++---
712866
 1 file changed, 4 insertions(+), 3 deletions(-)
712866
712866
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
5c6c2a
index 4971d18d..3983b7b7 100755
712866
--- a/modules.d/90multipath/module-setup.sh
712866
+++ b/modules.d/90multipath/module-setup.sh
712866
@@ -11,9 +11,10 @@ is_mpath() {
712866
 
712866
 majmin_to_mpath_dev() {
712866
     local _dev
712866
-    for i in `ls -1 /dev/mapper/mpath*`; do
712866
-        dev=$(get_maj_min $i)
712866
-        if [ "$dev" = "$1" ]; then
712866
+    for i in /dev/mapper/*; do
712866
+        [[ $i == /dev/mapper/control ]] && continue
712866
+        _dev=$(get_maj_min $i)
712866
+        if [ "$_dev" = "$1" ]; then
712866
             echo $i
712866
             return
712866
         fi