Blame SOURCES/0206-RHBZ-1239173-pt2-no-paths.patch

f20720
---
f20720
 libmultipath/configure.c    |    2 -
f20720
 libmultipath/devmapper.h    |    6 ++++
f20720
 multipath/11-dm-mpath.rules |   61 +++++++++++++++++++++++++++++++++-----------
f20720
 3 files changed, 54 insertions(+), 15 deletions(-)
f20720
f20720
Index: multipath-tools-130222/libmultipath/configure.c
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/libmultipath/configure.c
f20720
+++ multipath-tools-130222/libmultipath/configure.c
f20720
@@ -615,7 +615,7 @@ extern int
f20720
 domap (struct multipath * mpp, char * params)
f20720
 {
f20720
 	int r = 0;
f20720
-	uint16_t udev_flags = ((mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG) | ((mpp->skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0);
f20720
+	uint16_t udev_flags = ((mpp->force_udev_reload)? 0 : MPATH_UDEV_RELOAD_FLAG) | ((mpp->skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0) | ((mpp->nr_active)? 0 : MPATH_UDEV_NO_PATHS_FLAG);
f20720
 
f20720
 	/*
f20720
 	 * last chance to quit before touching the devmaps
f20720
Index: multipath-tools-130222/libmultipath/devmapper.h
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/libmultipath/devmapper.h
f20720
+++ multipath-tools-130222/libmultipath/devmapper.h
f20720
@@ -18,6 +18,12 @@
f20720
 #define MPATH_UDEV_NO_KPARTX_FLAG 0
f20720
 #endif
f20720
 
f20720
+#ifdef DM_SUBSYSTEM_UDEV_FLAG2
f20720
+#define MPATH_UDEV_NO_PATHS_FLAG DM_SUBSYSTEM_UDEV_FLAG2
f20720
+#else
f20720
+#define MPATH_UDEV_NO_PATHS_FLAG 0
f20720
+#endif
f20720
+
f20720
 void dm_init(void);
f20720
 int dm_prereq (void);
f20720
 int dm_drv_version (unsigned int * version, char * str);
f20720
Index: multipath-tools-130222/multipath/11-dm-mpath.rules
f20720
===================================================================
f20720
--- multipath-tools-130222.orig/multipath/11-dm-mpath.rules
f20720
+++ multipath-tools-130222/multipath/11-dm-mpath.rules
f20720
@@ -2,33 +2,66 @@ ACTION!="add|change", GOTO="mpath_end"
f20720
 ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="mpath_end"
f20720
 ENV{DM_UUID}!="mpath-?*", GOTO="mpath_end"
f20720
 
f20720
+IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD"
f20720
+IMPORT{db}="MPATH_DEVICE_READY"
f20720
+
f20720
+# If this uevent didn't come from dm, don't try to update the
f20720
+# device state
f20720
+ENV{DM_COOKIE}!="?*", ENV{DM_ACTION}!="PATH_*", IMPORT{db}="DM_UDEV_DISABLE_OTHER_RULES_FLAG", IMPORT{db}="DM_NOSCAN", GOTO="scan_import"
f20720
+
f20720
+ENV{.MPATH_DEVICE_READY_OLD}="$env{MPATH_DEVICE_READY}"
f20720
+
f20720
+# multipath sets DM_SUBSYSTEM_UDEV_FLAG2 when it reloads a
f20720
+# table with no active devices. If this happens, mark the
f20720
+# device not ready
f20720
+ENV{DM_SUBSYSTEM_UDEV_FLAG2}=="1", ENV{MPATH_DEVICE_READY}="0",\
f20720
+	GOTO="mpath_action"
f20720
+
f20720
+# If the last path has failed mark the device not ready
f20720
+ENV{DM_ACTION}=="PATH_FAILED", ENV{DM_NR_VALID_PATHS}=="0",\
f20720
+	ENV{MPATH_DEVICE_READY}="0", GOTO="mpath_action"
f20720
+
f20720
+# Don't mark a device ready on a PATH_FAILED event. even if
f20720
+# DM_NR_VALID_PATHS is greater than 0. Just keep the existing
f20720
+# value
f20720
+ENV{DM_ACTION}=="PATH_FAILED", GOTO="mpath_action"
f20720
+
f20720
+# This event is either a PATH_REINSTATED or a table reload where
f20720
+# there are active paths. Mark the device ready
f20720
+ENV{MPATH_DEVICE_READY}=""
f20720
+
f20720
+LABEL="mpath_action"
f20720
+# DM_SUBSYSTEM_UDEV_FLAG0 is the "RELOAD" flag for multipath subsystem.
f20720
+# Drop the DM_ACTIVATION flag here as mpath reloads tables if any of its
f20720
+# paths are lost/recovered. For any stack above the mpath device, this is not
f20720
+# something that should be reacted upon since it would be useless extra work.
f20720
+# It's exactly mpath's job to provide *seamless* device access to any of the
f20720
+# paths that are available underneath.
f20720
+ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", ENV{DM_ACTIVATION}="0"
f20720
+
f20720
 # Do not initiate scanning if no path is available,
f20720
 # otherwise there would be a hang or IO error on access.
f20720
 # We'd like to avoid this, especially within udev processing.
f20720
-ENV{DM_NR_VALID_PATHS}!="?*", IMPORT{db}="DM_NR_VALID_PATHS"
f20720
-ENV{DM_NR_VALID_PATHS}=="0", ENV{DM_NOSCAN}="1"
f20720
+ENV{MPATH_DEVICE_READY}=="0", ENV{DM_NOSCAN}="1"
f20720
 
f20720
 # Also skip all foreign rules if no path is available.
f20720
 # Remember the original value of DM_DISABLE_OTHER_RULES_FLAG
f20720
 # and restore it back once we have at least one path available.
f20720
-IMPORT{db}="DM_DISABLE_OTHER_RULES_FLAG_OLD"
f20720
-ENV{DM_ACTION}=="PATH_FAILED",\
f20720
-	ENV{DM_NR_VALID_PATHS}=="0",\
f20720
+ENV{MPATH_DEVICE_READY}=="0", ENV{.MPATH_DEVICE_READY_OLD}!="0",\
f20720
 	ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}=="",\
f20720
 	ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="$env{DM_UDEV_DISABLE_OTHER_RULES_FLAG}",\
f20720
 	ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1"
f20720
-ENV{DM_ACTION}=="PATH_REINSTATED",\
f20720
-	ENV{DM_NR_VALID_PATHS}=="1",\
f20720
+ENV{MPATH_DEVICE_READY}!="0", ENV{.MPATH_DEVICE_READY_OLD}=="0",\
f20720
 	ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{DM_DISABLE_OTHER_RULES_FLAG_OLD}",\
f20720
 	ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="",\
f20720
 	ENV{DM_ACTIVATION}="1"
f20720
 
f20720
-# DM_SUBSYSTEM_UDEV_FLAG0 is the "RELOAD" flag for multipath subsystem.
f20720
-# Drop the DM_ACTIVATION flag here as mpath reloads tables if any of its
f20720
-# paths are lost/recovered. For any stack above the mpath device, this is not
f20720
-# something that should be reacted upon since it would be useless extra work.
f20720
-# It's exactly mpath's job to provide *seamless* device access to any of the
f20720
-# paths that are available underneath.
f20720
-ENV{DM_SUBSYSTEM_UDEV_FLAG0}=="1", ENV{DM_ACTIVATION}="0"
f20720
+LABEL="scan_import"
f20720
+ENV{DM_NOSCAN}!="1", GOTO="mpath_end"
f20720
+ENV{ID_FS_TYPE}!="?*", IMPORT{db}="ID_FS_TYPE"
f20720
+ENV{ID_FS_USAGE}!="?*", IMPORT{db}="ID_FS_USAGE"
f20720
+ENV{ID_FS_UUID}!="?*", IMPORT{db}="ID_FS_UUID"
f20720
+ENV{ID_FS_ENC}!="?*", IMPORT{db}="ID_FS_UUID_ENC"
f20720
+ENV{ID_FS_VERSION}!="?*", IMPORT{db}="ID_FS_VERSION"
f20720
 
f20720
 LABEL="mpath_end"