Blame 0034-multipath-module-setup.sh-fix-host-only-mount-checks.patch

Harald Hoyer a633d0
From 63616dffe30add9fd4c0a22349fd33fe0fb3db1d Mon Sep 17 00:00:00 2001
Harald Hoyer a633d0
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer a633d0
Date: Wed, 25 Apr 2012 11:23:49 +0200
Harald Hoyer a633d0
Subject: [PATCH] multipath/module-setup.sh: fix host-only/mount checks
Harald Hoyer a633d0
Harald Hoyer a633d0
---
Harald Hoyer a633d0
 modules.d/90multipath/module-setup.sh |   16 +++++++---------
Harald Hoyer a633d0
 1 file changed, 7 insertions(+), 9 deletions(-)
Harald Hoyer a633d0
Harald Hoyer a633d0
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
Harald Hoyer a633d0
index 2bc1b41..ae9ec59 100755
Harald Hoyer a633d0
--- a/modules.d/90multipath/module-setup.sh
Harald Hoyer a633d0
+++ b/modules.d/90multipath/module-setup.sh
Harald Hoyer a633d0
@@ -11,18 +11,16 @@ check() {
Harald Hoyer a633d0
     [[ $debug ]] && set -x
Harald Hoyer a633d0
 
Harald Hoyer a633d0
     is_mpath() {
Harald Hoyer a633d0
-        [ -e /sys/dev/block/$1/dm/uuid ] || return 1
Harald Hoyer a633d0
-        [[ $(cat /sys/dev/block/$1/dm/uuid) =~ ^mpath- ]] && return 0
Harald Hoyer a633d0
+        local _dev
Harald Hoyer a633d0
+        _dev=${1##/dev/}
Harald Hoyer a633d0
+        [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
Harald Hoyer a633d0
+        [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ ^mpath- ]] && return 0
Harald Hoyer a633d0
         return 1
Harald Hoyer a633d0
     }
Harald Hoyer a633d0
 
Harald Hoyer a633d0
-    if [[ $hostonly ]]; then
Harald Hoyer a633d0
-        _rootdev=$(find_root_block_device)
Harald Hoyer a633d0
-        if [[ $_rootdev ]]; then
Harald Hoyer a633d0
-            check_block_and_slaves is_mpath "$_rootdev" && return 0
Harald Hoyer a633d0
-        fi
Harald Hoyer a633d0
-        return 1
Harald Hoyer a633d0
-    fi
Harald Hoyer a633d0
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
Harald Hoyer a633d0
+        for_each_host_dev_fs is_mpath || return 1
Harald Hoyer a633d0
+    }
Harald Hoyer a633d0
 
Harald Hoyer a633d0
     return 0
Harald Hoyer a633d0
 }