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

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