Blame SOURCES/0124-RHBZ-1209275-retrigger-uevents.patch

38852f
---
38852f
 libmultipath/config.c    |    2 ++
38852f
 libmultipath/config.h    |    2 ++
38852f
 libmultipath/defaults.h  |    2 ++
38852f
 libmultipath/dict.c      |   46 ++++++++++++++++++++++++++++++++++++++++++++++
38852f
 libmultipath/discovery.c |    8 +++++---
38852f
 libmultipath/structs.h   |    8 ++++++++
38852f
 multipathd/main.c        |   15 ++++++++++++++-
38852f
 7 files changed, 79 insertions(+), 4 deletions(-)
38852f
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
@@ -673,6 +673,8 @@ load_config (char * file, struct udev *u
38852f
 	conf->force_sync = 0;
38852f
 	conf->ignore_new_boot_devs = 0;
38852f
 	conf->processed_main_config = 0;
38852f
+	conf->retrigger_tries = DEFAULT_RETRIGGER_TRIES;
38852f
+	conf->retrigger_delay = DEFAULT_RETRIGGER_DELAY;
38852f
 
38852f
 	/*
38852f
 	 * preload default hwtable
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
@@ -139,6 +139,8 @@ struct config {
38852f
 	int processed_main_config;
38852f
 	int delay_watch_checks;
38852f
 	int delay_wait_checks;
38852f
+	int retrigger_tries;
38852f
+	int retrigger_delay;
38852f
 	unsigned int version[3];
38852f
 
38852f
 	char * dev;
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
@@ -21,6 +21,8 @@
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
+#define DEFAULT_RETRIGGER_DELAY 10
38852f
+#define DEFAULT_RETRIGGER_TRIES 3
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
@@ -839,6 +839,38 @@ def_delay_wait_checks_handler(vector str
38852f
 	return 0;
38852f
 }
38852f
 
38852f
+static int
38852f
+def_retrigger_tries_handler(vector strvec)
38852f
+{
38852f
+	char * buff;
38852f
+
38852f
+	buff = set_value(strvec);
38852f
+
38852f
+	if (!buff)
38852f
+		return 1;
38852f
+
38852f
+	conf->retrigger_tries = atoi(buff);
38852f
+	FREE(buff);
38852f
+
38852f
+	return 0;
38852f
+}
38852f
+
38852f
+static int
38852f
+def_retrigger_delay_handler(vector strvec)
38852f
+{
38852f
+	char * buff;
38852f
+
38852f
+	buff = set_value(strvec);
38852f
+
38852f
+	if (!buff)
38852f
+		return 1;
38852f
+
38852f
+	conf->retrigger_delay = atoi(buff);
38852f
+	FREE(buff);
38852f
+
38852f
+	return 0;
38852f
+}
38852f
+
38852f
 /*
38852f
  * blacklist block handlers
38852f
  */
38852f
@@ -3194,6 +3226,18 @@ snprint_def_delay_wait_checks(char * buf
38852f
 }
38852f
 
38852f
 static int
38852f
+snprint_def_retrigger_tries (char * buff, int len, void * data)
38852f
+{
38852f
+	return snprintf(buff, len, "%i", conf->retrigger_tries);
38852f
+}
38852f
+
38852f
+static int
38852f
+snprint_def_retrigger_delay (char * buff, int len, void * data)
38852f
+{
38852f
+	return snprintf(buff, len, "%i", conf->retrigger_delay);
38852f
+}
38852f
+
38852f
+static int
38852f
 snprint_ble_simple (char * buff, int len, void * data)
38852f
 {
38852f
 	struct blentry * ble = (struct blentry *)data;
38852f
@@ -3267,6 +3311,8 @@ init_keywords(void)
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
+	install_keyword("retrigger_tries", &def_retrigger_tries_handler, &snprint_def_retrigger_tries);
38852f
+	install_keyword("retrigger_delay", &def_retrigger_delay_handler, &snprint_def_retrigger_delay);
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
Index: multipath-tools-130222/libmultipath/discovery.c
38852f
===================================================================
38852f
--- multipath-tools-130222.orig/libmultipath/discovery.c
38852f
+++ multipath-tools-130222/libmultipath/discovery.c
38852f
@@ -1111,9 +1111,13 @@ get_uid (struct path * pp)
38852f
 			len = strlen(value);
38852f
 		}
38852f
 		strncpy(pp->wwid, value, len);
38852f
+		pp->missing_udev_info = INFO_OK;
38852f
+		pp->tick = 0;
38852f
 	} else {
38852f
 		condlog(3, "%s: no %s attribute", pp->dev,
38852f
 			pp->uid_attribute);
38852f
+		pp->missing_udev_info = INFO_MISSING;
38852f
+		pp->tick = conf->retrigger_delay;
38852f
 	}
38852f
 
38852f
 	/* Strip any trailing blanks */
38852f
@@ -1201,10 +1205,8 @@ pathinfo (struct path *pp, vector hwtabl
38852f
 	  * Retrieve path priority, even for PATH_DOWN paths if it has never
38852f
 	  * been successfully obtained before.
38852f
 	  */
38852f
-	if ((mask & DI_PRIO) && path_state == PATH_UP) {
38852f
+	if ((mask & DI_PRIO) && path_state == PATH_UP && strlen(pp->wwid)) {
38852f
 		if (pp->state != PATH_DOWN || pp->priority == PRIO_UNDEF) {
38852f
-			if (!strlen(pp->wwid))
38852f
-				get_uid(pp);
38852f
 			get_prio(pp);
38852f
 		}
38852f
 	}
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
@@ -139,6 +139,12 @@ enum delay_checks_states {
38852f
 	DELAY_CHECKS_UNDEF = 0,
38852f
 };
38852f
 
38852f
+enum missing_udev_info_states {
38852f
+	INFO_OK,
38852f
+	INFO_MISSING,
38852f
+	INFO_REQUESTED,
38852f
+};
38852f
+
38852f
 struct sg_id {
38852f
 	int host_no;
38852f
 	int channel;
38852f
@@ -193,6 +199,8 @@ struct path {
38852f
 	struct checker checker;
38852f
 	struct multipath * mpp;
38852f
 	int fd;
38852f
+	int missing_udev_info;
38852f
+	int retriggers;
38852f
 
38852f
 	/* configlet pointers */
38852f
 	struct hwentry * hwe;
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
@@ -708,6 +708,10 @@ uev_update_path (struct uevent *uev, str
38852f
 			uev->kernel);
38852f
 		return 1;
38852f
 	}
38852f
+
38852f
+	if (pp->missing_udev_info == INFO_REQUESTED)
38852f
+		return uev_add_path(uev, vecs);
38852f
+
38852f
 	/* reinit the prio values on change event, in case something is
38852f
 	 * different */
38852f
 	prio_init(&pp->prio);
38852f
@@ -1133,12 +1137,21 @@ check_path (struct vectors * vecs, struc
38852f
 	int chkr_new_path_up = 0;
38852f
 	int oldchkrstate = pp->chkrstate;
38852f
 
38852f
-	if (!pp->mpp)
38852f
+	if (!pp->mpp && (pp->missing_udev_info != INFO_MISSING ||
38852f
+			 pp->retriggers >= conf->retrigger_tries))
38852f
 		return;
38852f
 
38852f
 	if (pp->tick && --pp->tick)
38852f
 		return; /* don't check this path yet */
38852f
 
38852f
+	if (!pp->mpp) {
38852f
+		pp->missing_udev_info = INFO_REQUESTED;
38852f
+		pp->retriggers++;
38852f
+		sysfs_attr_set_value(pp->udev, "uevent", "change",
38852f
+				     strlen("change"));
38852f
+		return;
38852f
+	}
38852f
+
38852f
 	/*
38852f
 	 * provision a next check soonest,
38852f
 	 * in case we exit abnormaly from here