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

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