Blame SOURCES/0114-RHBZ-1196394-delayed-reintegration.patch

4ae388
---
4ae388
 libmultipath/checkers.c    |    3 
4ae388
 libmultipath/checkers.h    |    9 +
4ae388
 libmultipath/config.c      |    4 
4ae388
 libmultipath/config.h      |    6 +
4ae388
 libmultipath/configure.c   |    2 
4ae388
 libmultipath/defaults.h    |    1 
4ae388
 libmultipath/dict.c        |  204 ++++++++++++++++++++++++++++++++++++++++++++-
4ae388
 libmultipath/print.c       |    2 
4ae388
 libmultipath/propsel.c     |   52 +++++++++++
4ae388
 libmultipath/propsel.h     |    2 
4ae388
 libmultipath/structs.h     |    9 +
4ae388
 multipath.conf.annotated   |   40 ++++++++
4ae388
 multipath.conf.defaults    |    2 
4ae388
 multipath/multipath.conf.5 |   27 +++++
4ae388
 multipathd/main.c          |   34 ++++++-
4ae388
 15 files changed, 388 insertions(+), 9 deletions(-)
4ae388
4ae388
Index: multipath-tools-130222/libmultipath/config.h
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/config.h
4ae388
+++ multipath-tools-130222/libmultipath/config.h
4ae388
@@ -62,6 +62,8 @@ struct hwentry {
4ae388
 	int retain_hwhandler;
4ae388
 	int detect_prio;
4ae388
 	int deferred_remove;
4ae388
+	int delay_watch_checks;
4ae388
+	int delay_wait_checks;
4ae388
 	char * bl_product;
4ae388
 };
4ae388
 
4ae388
@@ -86,6 +88,8 @@ struct mpentry {
4ae388
 	int attribute_flags;
4ae388
 	int user_friendly_names;
4ae388
 	int deferred_remove;
4ae388
+	int delay_watch_checks;
4ae388
+	int delay_wait_checks;
4ae388
 	uid_t uid;
4ae388
 	gid_t gid;
4ae388
 	mode_t mode;
4ae388
@@ -133,6 +137,8 @@ struct config {
4ae388
 	int deferred_remove;
4ae388
 	int ignore_new_boot_devs;
4ae388
 	int processed_main_config;
4ae388
+	int delay_watch_checks;
4ae388
+	int delay_wait_checks;
4ae388
 	unsigned int version[3];
4ae388
 
4ae388
 	char * dev;
4ae388
Index: multipath-tools-130222/libmultipath/structs.h
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/structs.h
4ae388
+++ multipath-tools-130222/libmultipath/structs.h
4ae388
@@ -134,6 +134,11 @@ enum scsi_protocol {
4ae388
 	SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */
4ae388
 };
4ae388
 
4ae388
+enum delay_checks_states {
4ae388
+	DELAY_CHECKS_OFF = -1,
4ae388
+	DELAY_CHECKS_UNDEF = 0,
4ae388
+};
4ae388
+
4ae388
 struct sg_id {
4ae388
 	int host_no;
4ae388
 	int channel;
4ae388
@@ -180,6 +185,8 @@ struct path {
4ae388
 	int priority;
4ae388
 	int pgindex;
4ae388
 	int detect_prio;
4ae388
+	int watch_checks;
4ae388
+	int wait_checks;
4ae388
 	char * uid_attribute;
4ae388
 	struct prio prio;
4ae388
 	char * prio_args;
4ae388
@@ -215,6 +222,8 @@ struct multipath {
4ae388
 	int fast_io_fail;
4ae388
 	int retain_hwhandler;
4ae388
 	int deferred_remove;
4ae388
+	int delay_watch_checks;
4ae388
+	int delay_wait_checks;
4ae388
 	unsigned int dev_loss;
4ae388
 	uid_t uid;
4ae388
 	gid_t gid;
4ae388
Index: multipath-tools-130222/libmultipath/checkers.h
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/checkers.h
4ae388
+++ multipath-tools-130222/libmultipath/checkers.h
4ae388
@@ -46,6 +46,14 @@
4ae388
  * PATH_PENDING:
4ae388
  * - Use: All async checkers
4ae388
  * - Description: Indicates a check IO is in flight.
4ae388
+ *
4ae388
+ * PATH_DELAYED:
4ae388
+ * - Use: None of the checkers (returned if the path is being delayed before
4ae388
+ *   reintegration.
4ae388
+ * - Description: If a path fails after being up for less than
4ae388
+ *   delay_watch_checks checks, when it comes back up again, it will not
4ae388
+ *   be marked as up until it has been up for delay_wait_checks checks.
4ae388
+ *   During this time, it is marked as "delayed"
4ae388
  */
4ae388
 enum path_check_state {
4ae388
 	PATH_WILD,
4ae388
@@ -55,6 +63,7 @@ enum path_check_state {
4ae388
 	PATH_SHAKY,
4ae388
 	PATH_GHOST,
4ae388
 	PATH_PENDING,
4ae388
+	PATH_DELAYED,
4ae388
 	PATH_MAX_STATE
4ae388
 };
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
@@ -291,6 +291,8 @@ setup_map (struct multipath * mpp, char
4ae388
 	select_reservation_key(mpp);
4ae388
 	select_retain_hwhandler(mpp);
4ae388
 	select_deferred_remove(mpp);
4ae388
+	select_delay_watch_checks(mpp);
4ae388
+	select_delay_wait_checks(mpp);
4ae388
 
4ae388
 	sysfs_set_scsi_tmo(mpp);
4ae388
 	/*
4ae388
Index: multipath-tools-130222/libmultipath/defaults.h
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/defaults.h
4ae388
+++ multipath-tools-130222/libmultipath/defaults.h
4ae388
@@ -20,6 +20,7 @@
4ae388
 #define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_OFF
4ae388
 #define DEFAULT_DETECT_PRIO DETECT_PRIO_OFF
4ae388
 #define DEFAULT_DEFERRED_REMOVE DEFERRED_REMOVE_OFF
4ae388
+#define DEFAULT_DELAY_CHECKS DELAY_CHECKS_OFF
4ae388
 
4ae388
 #define DEFAULT_CHECKINT	5
4ae388
 #define MAX_CHECKINT(a)		(a << 2)
4ae388
Index: multipath-tools-130222/libmultipath/dict.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/dict.c
4ae388
+++ multipath-tools-130222/libmultipath/dict.c
4ae388
@@ -801,6 +801,44 @@ def_ignore_new_boot_devs_handler(vector
4ae388
 	return 0;
4ae388
 }
4ae388
 
4ae388
+static int
4ae388
+def_delay_watch_checks_handler(vector strvec)
4ae388
+{
4ae388
+	char * buff;
4ae388
+
4ae388
+	buff = set_value(strvec);
4ae388
+	if (!buff)
4ae388
+		return 1;
4ae388
+
4ae388
+	if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
4ae388
+	    (strlen(buff) == 1 && !strcmp(buff, "0")))
4ae388
+		conf->delay_watch_checks = DELAY_CHECKS_OFF;
4ae388
+	else if ((conf->delay_watch_checks = atoi(buff)) < 1)
4ae388
+		conf->delay_watch_checks = DELAY_CHECKS_OFF;
4ae388
+
4ae388
+	FREE(buff);
4ae388
+	return 0;
4ae388
+}
4ae388
+
4ae388
+static int
4ae388
+def_delay_wait_checks_handler(vector strvec)
4ae388
+{
4ae388
+	char * buff;
4ae388
+
4ae388
+	buff = set_value(strvec);
4ae388
+	if (!buff)
4ae388
+		return 1;
4ae388
+
4ae388
+	if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
4ae388
+	    (strlen(buff) == 1 && !strcmp(buff, "0")))
4ae388
+		conf->delay_wait_checks = DELAY_CHECKS_OFF;
4ae388
+	else if ((conf->delay_wait_checks = atoi(buff)) < 1)
4ae388
+		conf->delay_wait_checks = DELAY_CHECKS_OFF;
4ae388
+
4ae388
+	FREE(buff);
4ae388
+	return 0;
4ae388
+}
4ae388
+
4ae388
 /*
4ae388
  * blacklist block handlers
4ae388
  */
4ae388
@@ -1517,6 +1555,52 @@ hw_deferred_remove_handler(vector strvec
4ae388
 	return 0;
4ae388
 }
4ae388
 
4ae388
+static int
4ae388
+hw_delay_watch_checks_handler(vector strvec)
4ae388
+{
4ae388
+	struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
4ae388
+	char * buff;
4ae388
+
4ae388
+	if (!hwe)
4ae388
+		return 1;
4ae388
+
4ae388
+	buff = set_value(strvec);
4ae388
+	if (!buff)
4ae388
+		return 1;
4ae388
+
4ae388
+	if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
4ae388
+	    (strlen(buff) == 1 && !strcmp(buff, "0")))
4ae388
+		hwe->delay_watch_checks = DELAY_CHECKS_OFF;
4ae388
+	else if ((hwe->delay_watch_checks = atoi(buff)) < 1)
4ae388
+		hwe->delay_watch_checks = DELAY_CHECKS_OFF;
4ae388
+
4ae388
+	FREE(buff);
4ae388
+	return 0;
4ae388
+}
4ae388
+
4ae388
+static int
4ae388
+hw_delay_wait_checks_handler(vector strvec)
4ae388
+{
4ae388
+	struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
4ae388
+	char * buff;
4ae388
+
4ae388
+	if (!hwe)
4ae388
+		return 1;
4ae388
+
4ae388
+	buff = set_value(strvec);
4ae388
+	if (!buff)
4ae388
+		return 1;
4ae388
+
4ae388
+	if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
4ae388
+	    (strlen(buff) == 1 && !strcmp(buff, "0")))
4ae388
+		hwe->delay_wait_checks = DELAY_CHECKS_OFF;
4ae388
+	else if ((hwe->delay_wait_checks = atoi(buff)) < 1)
4ae388
+		hwe->delay_wait_checks = DELAY_CHECKS_OFF;
4ae388
+
4ae388
+	FREE(buff);
4ae388
+	return 0;
4ae388
+}
4ae388
+
4ae388
 /*
4ae388
  * multipaths block handlers
4ae388
  */
4ae388
@@ -1996,6 +2080,52 @@ mp_deferred_remove_handler(vector strvec
4ae388
 	return 0;
4ae388
 }
4ae388
 
4ae388
+static int
4ae388
+mp_delay_watch_checks_handler(vector strvec)
4ae388
+{
4ae388
+	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
4ae388
+	char * buff;
4ae388
+
4ae388
+	if (!mpe)
4ae388
+		return 1;
4ae388
+
4ae388
+	buff = set_value(strvec);
4ae388
+	if (!buff)
4ae388
+		return 1;
4ae388
+
4ae388
+	if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
4ae388
+	    (strlen(buff) == 1 && !strcmp(buff, "0")))
4ae388
+		mpe->delay_watch_checks = DELAY_CHECKS_OFF;
4ae388
+	else if ((mpe->delay_watch_checks = atoi(buff)) < 1)
4ae388
+		mpe->delay_watch_checks = DELAY_CHECKS_OFF;
4ae388
+
4ae388
+	FREE(buff);
4ae388
+	return 0;
4ae388
+}
4ae388
+
4ae388
+static int
4ae388
+mp_delay_wait_checks_handler(vector strvec)
4ae388
+{
4ae388
+	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
4ae388
+	char * buff;
4ae388
+
4ae388
+	if (!mpe)
4ae388
+		return 1;
4ae388
+
4ae388
+	buff = set_value(strvec);
4ae388
+	if (!buff)
4ae388
+		return 1;
4ae388
+
4ae388
+	if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
4ae388
+	    (strlen(buff) == 1 && !strcmp(buff, "0")))
4ae388
+		mpe->delay_wait_checks = DELAY_CHECKS_OFF;
4ae388
+	else if ((mpe->delay_wait_checks = atoi(buff)) < 1)
4ae388
+		mpe->delay_wait_checks = DELAY_CHECKS_OFF;
4ae388
+
4ae388
+	FREE(buff);
4ae388
+	return 0;
4ae388
+}
4ae388
+
4ae388
 /*
4ae388
  * config file keywords printing
4ae388
  */
4ae388
@@ -2258,6 +2388,30 @@ snprint_mp_deferred_remove (char * buff,
4ae388
 }
4ae388
 
4ae388
 static int
4ae388
+snprint_mp_delay_watch_checks(char * buff, int len, void * data)
4ae388
+{
4ae388
+	struct mpentry * mpe = (struct mpentry *)data;
4ae388
+
4ae388
+	if (mpe->delay_watch_checks == DELAY_CHECKS_UNDEF)
4ae388
+		return 0;
4ae388
+	if (mpe->delay_watch_checks == DELAY_CHECKS_OFF)
4ae388
+		return snprintf(buff, len, "no");
4ae388
+	return snprintf(buff, len, "%d", mpe->delay_watch_checks);
4ae388
+}
4ae388
+
4ae388
+static int
4ae388
+snprint_mp_delay_wait_checks(char * buff, int len, void * data)
4ae388
+{
4ae388
+	struct mpentry * mpe = (struct mpentry *)data;
4ae388
+
4ae388
+	if (mpe->delay_wait_checks == DELAY_CHECKS_UNDEF)
4ae388
+		return 0;
4ae388
+	if (mpe->delay_wait_checks == DELAY_CHECKS_OFF)
4ae388
+		return snprintf(buff, len, "no");
4ae388
+	return snprintf(buff, len, "%d", mpe->delay_wait_checks);
4ae388
+}
4ae388
+
4ae388
+static int
4ae388
 snprint_hw_fast_io_fail(char * buff, int len, void * data)
4ae388
 {
4ae388
 	struct hwentry * hwe = (struct hwentry *)data;
4ae388
@@ -2586,6 +2740,30 @@ snprint_hw_deferred_remove(char * buff,
4ae388
 }
4ae388
 
4ae388
 static int
4ae388
+snprint_hw_delay_watch_checks(char * buff, int len, void * data)
4ae388
+{
4ae388
+	struct hwentry * hwe = (struct hwentry *)data;
4ae388
+
4ae388
+	if (hwe->delay_watch_checks == DELAY_CHECKS_UNDEF)
4ae388
+		return 0;
4ae388
+	if (hwe->delay_watch_checks == DELAY_CHECKS_OFF)
4ae388
+		return snprintf(buff, len, "no");
4ae388
+	return snprintf(buff, len, "%d", hwe->delay_watch_checks);
4ae388
+}
4ae388
+
4ae388
+static int
4ae388
+snprint_hw_delay_wait_checks(char * buff, int len, void * data)
4ae388
+{
4ae388
+	struct hwentry * hwe = (struct hwentry *)data;
4ae388
+
4ae388
+	if (hwe->delay_wait_checks == DELAY_CHECKS_UNDEF)
4ae388
+		return 0;
4ae388
+	if (hwe->delay_wait_checks == DELAY_CHECKS_OFF)
4ae388
+		return snprintf(buff, len, "no");
4ae388
+	return snprintf(buff, len, "%d", hwe->delay_wait_checks);
4ae388
+}
4ae388
+
4ae388
+static int
4ae388
 snprint_detect_prio(char * buff, int len, void * data)
4ae388
 {
4ae388
 	struct hwentry * hwe = (struct hwentry *)data;
4ae388
@@ -2883,7 +3061,6 @@ snprint_def_find_multipaths (char * buff
4ae388
 	return snprintf(buff, len, "yes");
4ae388
 }
4ae388
 
4ae388
-
4ae388
 static int
4ae388
 snprint_def_user_friendly_names (char * buff, int len, void * data)
4ae388
 {
4ae388
@@ -2989,7 +3166,6 @@ snprint_def_ignore_new_boot_devs(char *
4ae388
 		return snprintf(buff, len, "no");
4ae388
 }
4ae388
 
4ae388
-
4ae388
 static int
4ae388
 snprint_def_config_dir (char * buff, int len, void * data)
4ae388
 {
4ae388
@@ -3000,6 +3176,24 @@ snprint_def_config_dir (char * buff, int
4ae388
 }
4ae388
 
4ae388
 static int
4ae388
+snprint_def_delay_watch_checks(char * buff, int len, void * data)
4ae388
+{
4ae388
+	if (conf->delay_watch_checks == DELAY_CHECKS_UNDEF ||
4ae388
+	    conf->delay_watch_checks == DELAY_CHECKS_OFF)
4ae388
+		return snprintf(buff, len, "no");
4ae388
+	return snprintf(buff, len, "%d", conf->delay_watch_checks);
4ae388
+}
4ae388
+
4ae388
+static int
4ae388
+snprint_def_delay_wait_checks(char * buff, int len, void * data)
4ae388
+{
4ae388
+	if (conf->delay_wait_checks == DELAY_CHECKS_UNDEF ||
4ae388
+	    conf->delay_wait_checks == DELAY_CHECKS_OFF)
4ae388
+		return snprintf(buff, len, "no");
4ae388
+	return snprintf(buff, len, "%d", conf->delay_wait_checks);
4ae388
+}
4ae388
+
4ae388
+static int
4ae388
 snprint_ble_simple (char * buff, int len, void * data)
4ae388
 {
4ae388
 	struct blentry * ble = (struct blentry *)data;
4ae388
@@ -3071,6 +3265,8 @@ init_keywords(void)
4ae388
 	install_keyword("deferred_remove", &def_deferred_remove_handler, &snprint_def_deferred_remove);
4ae388
 	install_keyword("ignore_new_boot_devs", &def_ignore_new_boot_devs_handler, &snprint_def_ignore_new_boot_devs);
4ae388
 	install_keyword("config_dir", &def_config_dir_handler, &snprint_def_config_dir);
4ae388
+	install_keyword("delay_watch_checks", &def_delay_watch_checks_handler, &snprint_def_delay_watch_checks);
4ae388
+	install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks);
4ae388
 	__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
4ae388
 	__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
4ae388
 	__deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL);
4ae388
@@ -3136,6 +3332,8 @@ init_keywords(void)
4ae388
 	install_keyword("retain_attached_hw_handler", &hw_retain_hwhandler_handler, &snprint_hw_retain_hwhandler_handler);
4ae388
 	install_keyword("detect_prio", &hw_detect_prio_handler, &snprint_detect_prio);
4ae388
 	install_keyword("deferred_remove", &hw_deferred_remove_handler, &snprint_hw_deferred_remove);
4ae388
+	install_keyword("delay_watch_checks", &hw_delay_watch_checks_handler, &snprint_hw_delay_watch_checks);
4ae388
+	install_keyword("delay_wait_checks", &hw_delay_wait_checks_handler, &snprint_hw_delay_wait_checks);
4ae388
 	install_sublevel_end();
4ae388
 
4ae388
 	install_keyword_root("multipaths", &multipaths_handler);
4ae388
@@ -3161,5 +3359,7 @@ init_keywords(void)
4ae388
 	install_keyword("reservation_key", &mp_reservation_key_handler, &snprint_mp_reservation_key);
4ae388
 	install_keyword("user_friendly_names", &mp_names_handler, &snprint_mp_user_friendly_names);
4ae388
 	install_keyword("deferred_remove", &mp_deferred_remove_handler, &snprint_mp_deferred_remove);
4ae388
+	install_keyword("delay_watch_checks", &mp_delay_watch_checks_handler, &snprint_mp_delay_watch_checks);
4ae388
+	install_keyword("delay_wait_checks", &mp_delay_wait_checks_handler, &snprint_mp_delay_wait_checks);
4ae388
 	install_sublevel_end();
4ae388
 }
4ae388
Index: multipath-tools-130222/libmultipath/print.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/print.c
4ae388
+++ multipath-tools-130222/libmultipath/print.c
4ae388
@@ -336,6 +336,8 @@ snprint_chk_state (char * buff, size_t l
4ae388
 		return snprintf(buff, len, "shaky");
4ae388
 	case PATH_GHOST:
4ae388
 		return snprintf(buff, len, "ghost");
4ae388
+	case PATH_DELAYED:
4ae388
+		return snprintf(buff, len, "delayed");
4ae388
 	default:
4ae388
 		return snprintf(buff, len, "undef");
4ae388
 	}
4ae388
Index: multipath-tools-130222/libmultipath/propsel.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/propsel.c
4ae388
+++ multipath-tools-130222/libmultipath/propsel.c
4ae388
@@ -788,3 +788,55 @@ select_detect_prio (struct path * pp)
4ae388
 	condlog(3, "%s: detect_prio = %d (compiled in default)", pp->dev, pp->detect_prio);
4ae388
 	return 0;
4ae388
 }
4ae388
+
4ae388
+extern int
4ae388
+select_delay_watch_checks (struct multipath * mp)
4ae388
+{
4ae388
+	if (mp->mpe && mp->mpe->delay_watch_checks != DELAY_CHECKS_UNDEF) {
4ae388
+		mp->delay_watch_checks = mp->mpe->delay_watch_checks;
4ae388
+		condlog(3, "delay_watch_checks = %i (multipath setting)",
4ae388
+				mp->delay_watch_checks);
4ae388
+		return 0;
4ae388
+	}
4ae388
+	if (mp->hwe && mp->hwe->delay_watch_checks != DELAY_CHECKS_UNDEF) {
4ae388
+		mp->delay_watch_checks = mp->hwe->delay_watch_checks;
4ae388
+		condlog(3, "delay_watch_checks = %i (controler setting)",
4ae388
+				mp->delay_watch_checks);
4ae388
+		return 0;
4ae388
+	}
4ae388
+	if (conf->delay_watch_checks != DELAY_CHECKS_UNDEF) {
4ae388
+		mp->delay_watch_checks = conf->delay_watch_checks;
4ae388
+		condlog(3, "delay_watch_checks = %i (config file default)",
4ae388
+				mp->delay_watch_checks);
4ae388
+		return 0;
4ae388
+	}
4ae388
+	mp->delay_watch_checks = DEFAULT_DELAY_CHECKS;
4ae388
+	condlog(3, "delay_watch_checks = DISABLED (internal default)");
4ae388
+	return 0;
4ae388
+}
4ae388
+
4ae388
+extern int
4ae388
+select_delay_wait_checks (struct multipath * mp)
4ae388
+{
4ae388
+	if (mp->mpe && mp->mpe->delay_wait_checks != DELAY_CHECKS_UNDEF) {
4ae388
+		mp->delay_wait_checks = mp->mpe->delay_wait_checks;
4ae388
+		condlog(3, "delay_wait_checks = %i (multipath setting)",
4ae388
+				mp->delay_wait_checks);
4ae388
+		return 0;
4ae388
+	}
4ae388
+	if (mp->hwe && mp->hwe->delay_wait_checks != DELAY_CHECKS_UNDEF) {
4ae388
+		mp->delay_wait_checks = mp->hwe->delay_wait_checks;
4ae388
+		condlog(3, "delay_wait_checks = %i (controler setting)",
4ae388
+				mp->delay_wait_checks);
4ae388
+		return 0;
4ae388
+	}
4ae388
+	if (conf->delay_wait_checks != DELAY_CHECKS_UNDEF) {
4ae388
+		mp->delay_wait_checks = conf->delay_wait_checks;
4ae388
+		condlog(3, "delay_wait_checks = %i (config file default)",
4ae388
+				mp->delay_wait_checks);
4ae388
+		return 0;
4ae388
+	}
4ae388
+	mp->delay_wait_checks = DEFAULT_DELAY_CHECKS;
4ae388
+	condlog(3, "delay_wait_checks = DISABLED (internal default)");
4ae388
+	return 0;
4ae388
+}
4ae388
Index: multipath-tools-130222/libmultipath/propsel.h
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/propsel.h
4ae388
+++ multipath-tools-130222/libmultipath/propsel.h
4ae388
@@ -21,3 +21,5 @@ int select_reservation_key(struct multip
4ae388
 int select_retain_hwhandler (struct multipath * mp);
4ae388
 int select_detect_prio(struct path * pp);
4ae388
 int select_deferred_remove(struct multipath *mp);
4ae388
+int select_delay_watch_checks (struct multipath * mp);
4ae388
+int select_delay_wait_checks (struct multipath * mp);
4ae388
Index: multipath-tools-130222/multipathd/main.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/multipathd/main.c
4ae388
+++ multipath-tools-130222/multipathd/main.c
4ae388
@@ -188,7 +188,8 @@ sync_map_state(struct multipath *mpp)
4ae388
 	vector_foreach_slot (mpp->pg, pgp, i){
4ae388
 		vector_foreach_slot (pgp->paths, pp, j){
4ae388
 			if (pp->state == PATH_UNCHECKED || 
4ae388
-			    pp->state == PATH_WILD)
4ae388
+			    pp->state == PATH_WILD ||
4ae388
+			    pp->state == PATH_DELAYED)
4ae388
 				continue;
4ae388
 			if ((pp->dmstate == PSTATE_FAILED ||
4ae388
 			     pp->dmstate == PSTATE_UNDEF) &&
4ae388
@@ -1165,6 +1166,16 @@ check_path (struct vectors * vecs, struc
4ae388
 	if (!pp->mpp)
4ae388
 		return;
4ae388
 
4ae388
+	if ((newstate == PATH_UP || newstate == PATH_GHOST) &&
4ae388
+	     pp->wait_checks > 0) {
4ae388
+		if (pp->mpp && pp->mpp->nr_active > 0) {
4ae388
+			pp->state = PATH_DELAYED;
4ae388
+			pp->wait_checks--;
4ae388
+			return;
4ae388
+		} else
4ae388
+			pp->wait_checks = 0;
4ae388
+	}
4ae388
+
4ae388
 	pp->chkrstate = newstate;
4ae388
 	if (newstate != pp->state) {
4ae388
 		int oldstate = pp->state;
4ae388
@@ -1182,9 +1193,14 @@ check_path (struct vectors * vecs, struc
4ae388
 			 * proactively fail path in the DM
4ae388
 			 */
4ae388
 			if (oldstate == PATH_UP ||
4ae388
-			    oldstate == PATH_GHOST)
4ae388
+			    oldstate == PATH_GHOST) {
4ae388
 				fail_path(pp, 1);
4ae388
-			else
4ae388
+				if (pp->mpp->delay_wait_checks > 0 &&
4ae388
+				    pp->watch_checks > 0) {
4ae388
+					pp->wait_checks = pp->mpp->delay_wait_checks;
4ae388
+					pp->watch_checks = 0;
4ae388
+				}
4ae388
+			}else
4ae388
 				fail_path(pp, 0);
4ae388
 
4ae388
 			/*
4ae388
@@ -1211,11 +1227,15 @@ check_path (struct vectors * vecs, struc
4ae388
 		 * reinstate this path
4ae388
 		 */
4ae388
 		if (oldstate != PATH_UP &&
4ae388
-		    oldstate != PATH_GHOST)
4ae388
+		    oldstate != PATH_GHOST) {
4ae388
+			if (pp->mpp->delay_watch_checks > 0)
4ae388
+				pp->watch_checks = pp->mpp->delay_watch_checks;
4ae388
 			reinstate_path(pp, 1);
4ae388
-		else
4ae388
+		} else {
4ae388
+			if (pp->watch_checks > 0)
4ae388
+				pp->watch_checks--;
4ae388
 			reinstate_path(pp, 0);
4ae388
-
4ae388
+		}
4ae388
 		new_path_up = 1;
4ae388
 
4ae388
 		if (oldchkrstate != PATH_UP && oldchkrstate != PATH_GHOST)
4ae388
@@ -1245,6 +1265,8 @@ check_path (struct vectors * vecs, struc
4ae388
 				else
4ae388
 					pp->checkint = conf->max_checkint;
4ae388
 			}
4ae388
+			if (pp->watch_checks > 0)
4ae388
+				pp->watch_checks--;
4ae388
 			pp->tick = pp->checkint;
4ae388
 			condlog(4, "%s: delay next check %is",
4ae388
 				pp->dev_t, pp->tick);
4ae388
Index: multipath-tools-130222/multipath.conf.annotated
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/multipath.conf.annotated
4ae388
+++ multipath-tools-130222/multipath.conf.annotated
4ae388
@@ -242,6 +242,30 @@
4ae388
 #	#           files, just as if it was in /etc/multipath.conf
4ae388
 #	# values  : "" or a fully qualified pathname
4ae388
 #	# default : "/etc/multipath/conf.d"
4ae388
+#
4ae388
+#	#
4ae388
+#	# name    : delay_watch_checks
4ae388
+#	# scope   : multipathd
4ae388
+#	# desc    : If set to a value greater than 0, multipathd will watch
4ae388
+#	#           paths that have recently become valid for this many
4ae388
+#	#           checks.  If they fail again while they are being watched,
4ae388
+#	#           when they next become valid, they will not be used until
4ae388
+#	#           they have stayed up for delay_wait_checks checks.
4ae388
+#	# values  : no|<n> > 0
4ae388
+#	# default : no
4ae388
+#	delay_watch_checks 12
4ae388
+#
4ae388
+#	#
4ae388
+#	# name    : delay_wait_checks
4ae388
+#	# scope   : multipathd
4ae388
+#	# desc    : If set to a value greater than 0, when a device that has
4ae388
+#	#           recently come back online fails again within
4ae388
+#	#           delay_watch_checks checks, the next time it comes back
4ae388
+#	#           online, it will marked and delayed, and not used until
4ae388
+#	#           it has passed delay_wait_checks checks.
4ae388
+#	# values  : no|<n> > 0
4ae388
+#	# default : no
4ae388
+#	delay_wait_checks 12
4ae388
 #}
4ae388
 #	
4ae388
 ##
4ae388
@@ -383,6 +407,13 @@
4ae388
 #		#
4ae388
 #		flush_on_last_del       yes
4ae388
 #
4ae388
+#		#
4ae388
+#		# name    : delay_watch_checks
4ae388
+#		# See defualts section for information.
4ae388
+#
4ae388
+#		#
4ae388
+#		# name    : delay_wait_checks
4ae388
+#		# See defualts section for information.
4ae388
 #	}
4ae388
 #	multipath {
4ae388
 #		wwid	1DEC_____321816758474
4ae388
@@ -566,6 +597,15 @@
4ae388
 #		#           before removing it from the system.
4ae388
 #		# values  : n > 0
4ae388
 #		dev_loss_tmo 600
4ae388
+#
4ae388
+#		#
4ae388
+#		# name    : delay_watch_checks
4ae388
+#		# See defaults section for information.
4ae388
+#
4ae388
+#		#
4ae388
+#		# name    : delay_wait_checks
4ae388
+#		# See defaults section for information.
4ae388
+#
4ae388
 #	}
4ae388
 #	device {
4ae388
 #		vendor			"COMPAQ  "
4ae388
Index: multipath-tools-130222/multipath.conf.defaults
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/multipath.conf.defaults
4ae388
+++ multipath-tools-130222/multipath.conf.defaults
4ae388
@@ -27,6 +27,8 @@
4ae388
 #	retain_attached_hw_handler no
4ae388
 #	detect_prio no
4ae388
 #	config_dir "/etc/multipath/conf.d"
4ae388
+#	delay_watch_checks no
4ae388
+#	delay_wait_checks no
4ae388
 #}
4ae388
 #blacklist {
4ae388
 #	devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
4ae388
Index: multipath-tools-130222/multipath/multipath.conf.5
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/multipath/multipath.conf.5
4ae388
+++ multipath-tools-130222/multipath/multipath.conf.5
4ae388
@@ -459,6 +459,25 @@ alphabetically for file ending in ".conf
4ae388
 information from them, just as if it was in /etc/multipath.conf.  config_dir
4ae388
 must either be "" or a fully qualified directory name. Default is
4ae388
 .I "/etc/multipath/conf.d"
4ae388
+.TP
4ae388
+.B delay_watch_checks
4ae388
+If set to a value greater than 0, multipathd will watch paths that have
4ae388
+recently become valid for this many checks.  If they fail again while they are
4ae388
+being watched, when they next become valid, they will not be used until they
4ae388
+have stayed up for
4ae388
+.I delay_wait_checks
4ae388
+checks. Default is
4ae388
+.I no
4ae388
+.TP
4ae388
+.B delay_wait_checks
4ae388
+If set to a value greater than 0, when a device that has recently come back
4ae388
+online fails again within
4ae388
+.I delay_watch_checks
4ae388
+checks, the next time it comes back online, it will marked and delayed, and not
4ae388
+used until it has passed
4ae388
+.I delay_wait_checks
4ae388
+checks. Default is
4ae388
+.I no
4ae388
 .
4ae388
 .SH "blacklist section"
4ae388
 The
4ae388
@@ -562,6 +581,10 @@ section:
4ae388
 .B reservation_key
4ae388
 .TP
4ae388
 .B deferred_remove
4ae388
+.TP
4ae388
+.B delay_watch_checks
4ae388
+.TP
4ae388
+.B delay_wait_checks
4ae388
 .RE
4ae388
 .PD
4ae388
 .LP
4ae388
@@ -654,6 +677,10 @@ section:
4ae388
 .B detect_prio
4ae388
 .TP
4ae388
 .B deferred_remove
4ae388
+.TP
4ae388
+.B delay_watch_checks
4ae388
+.TP
4ae388
+.B delay_wait_checks
4ae388
 .RE
4ae388
 .PD
4ae388
 .LP
4ae388
Index: multipath-tools-130222/libmultipath/checkers.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/checkers.c
4ae388
+++ multipath-tools-130222/libmultipath/checkers.c
4ae388
@@ -16,7 +16,8 @@ char *checker_state_names[] = {
4ae388
       "up",
4ae388
       "shaky",
4ae388
       "ghost",
4ae388
-      "pending"
4ae388
+      "pending",
4ae388
+      "delayed"
4ae388
 };
4ae388
 
4ae388
 static LIST_HEAD(checkers);
4ae388
Index: multipath-tools-130222/libmultipath/config.c
4ae388
===================================================================
4ae388
--- multipath-tools-130222.orig/libmultipath/config.c
4ae388
+++ multipath-tools-130222/libmultipath/config.c
4ae388
@@ -341,6 +341,8 @@ merge_hwe (struct hwentry * dst, struct
4ae388
 	merge_num(retain_hwhandler);
4ae388
 	merge_num(detect_prio);
4ae388
 	merge_num(deferred_remove);
4ae388
+	merge_num(delay_watch_checks);
4ae388
+	merge_num(delay_wait_checks);
4ae388
 
4ae388
 	/*
4ae388
 	 * Make sure features is consistent with
4ae388
@@ -399,6 +401,8 @@ overwrite_hwe (struct hwentry * dst, str
4ae388
 	overwrite_num(retain_hwhandler);
4ae388
 	overwrite_num(detect_prio);
4ae388
 	overwrite_num(deferred_remove);
4ae388
+	overwrite_num(delay_watch_checks);
4ae388
+	overwrite_num(delay_wait_checks);
4ae388
 
4ae388
 	/*
4ae388
 	 * Make sure features is consistent with