File multipath-tools-no-kpartx-for-zero-paths-devices of Package multipath-tools

commit a9874e1e6928bcc8297dc3e2a19cf70a1e691e99
Author: Hannes Reinecke <hare@suse.de>
Date:   Mon Feb 23 16:23:31 2009 +0100

    Do not start kpartx if no paths are active
    
    When multipath runs in a zero-path configuration it's pointless
    to start kpartx as it can't read anything.
    Worse, it's keeping the table busy so we can't flush dead maps.
    
    Signed-off-by: Hannes Reinecke <hare@suse.de>

diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index ddb65e2..9b75fdd 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -30,7 +30,7 @@ ENV{DM_PART}=="?*", \
         SYMLINK+="disk/by-id/$env{DM_TYPE}-$env{DM_NAME}-part$env{DM_PART}"
 
 # Create dm tables for partitions
-ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \
+ENV{DM_STATE}!="SUSPENDED", ENV{DM_DEPS}!="0", ENV{DM_UUID}=="mpath-*", \
         RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
 ENV{DM_STATE}=="ACTIVE", ENV{DM_UUID}=="DMRAID-*", \
         RUN+="/sbin/kpartx -a -p _part /dev/$kernel"
diff --git a/kpartx/kpartx_id b/kpartx/kpartx_id
index c402e98..9e07c7c 100644
--- a/kpartx/kpartx_id
+++ b/kpartx/kpartx_id
@@ -90,6 +90,8 @@ if [ -n "$dmdeps" ] ; then
             echo "DM_TYPE=scsi"
 	    ;;
     esac
+    set -- $dmdeps
+    echo "DM_DEPS=$1"
 elif [ "$dmtbl" = linear ]; then
     echo "DM_TYPE=${dmuuid%%-*}"
     echo "DM_NAME=${dmuuid#*-}"
openSUSE Build Service is sponsored by