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

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