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

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