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

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