Blame SOURCES/0089-RHBZ-1110016-add-noasync-option.patch

38852f
---
38852f
 libmultipath/config.c      |    1 +
38852f
 libmultipath/config.h      |    1 +
38852f
 libmultipath/dict.c        |   33 +++++++++++++++++++++++++++++++++
38852f
 libmultipath/discovery.c   |    8 ++++++--
38852f
 multipath.conf.annotated   |   10 ++++++++++
38852f
 multipath/multipath.conf.5 |    9 +++++++++
38852f
 6 files changed, 60 insertions(+), 2 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
@@ -556,6 +556,7 @@ load_config (char * file, struct udev *u
38852f
 	conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER;
38852f
 	conf->detect_prio = DEFAULT_DETECT_PRIO;
38852f
 	conf->hw_strmatch = 0;
38852f
+	conf->force_sync = 0;
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
@@ -115,6 +115,7 @@ struct config {
38852f
 	int reassign_maps;
38852f
 	int retain_hwhandler;
38852f
 	int detect_prio;
38852f
+	int force_sync;
38852f
 	unsigned int version[3];
38852f
 
38852f
 	char * dev;
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
@@ -712,6 +712,29 @@ def_hw_strmatch_handler(vector strvec)
38852f
 	return 0;
38852f
 }
38852f
 
38852f
+static int
38852f
+def_force_sync_handler(vector strvec)
38852f
+{
38852f
+	char * buff;
38852f
+
38852f
+	buff = set_value(strvec);
38852f
+
38852f
+	if (!buff)
38852f
+		return 1;
38852f
+
38852f
+	if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
38852f
+	    (strlen(buff) == 1 && !strcmp(buff, "0")))
38852f
+		conf->force_sync = 0;
38852f
+	else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
38852f
+		 (strlen(buff) == 1 && !strcmp(buff, "1")))
38852f
+		conf->force_sync = 1;
38852f
+	else
38852f
+		conf->force_sync = 0;
38852f
+
38852f
+	FREE(buff);
38852f
+	return 0;
38852f
+}
38852f
+
38852f
 /*
38852f
  * blacklist block handlers
38852f
  */
38852f
@@ -2822,6 +2845,15 @@ snprint_def_hw_strmatch(char * buff, int
38852f
 }
38852f
 
38852f
 static int
38852f
+snprint_def_force_sync(char * buff, int len, void * data)
38852f
+{
38852f
+	if (conf->force_sync)
38852f
+		return snprintf(buff, len, "yes");
38852f
+	else
38852f
+		return snprintf(buff, len, "no");
38852f
+}
38852f
+
38852f
+static int
38852f
 snprint_ble_simple (char * buff, int len, void * data)
38852f
 {
38852f
 	struct blentry * ble = (struct blentry *)data;
38852f
@@ -2889,6 +2921,7 @@ init_keywords(void)
38852f
 	install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler);
38852f
 	install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio);
38852f
 	install_keyword("hw_str_match", &def_hw_strmatch_handler, &snprint_def_hw_strmatch);
38852f
+	install_keyword("force_sync", &def_force_sync_handler, &snprint_def_force_sync);
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
@@ -952,8 +952,12 @@ get_state (struct path * pp, int daemon)
38852f
 		}
38852f
 	}
38852f
 	checker_clear_message(c);
38852f
-	if (daemon)
38852f
-		checker_set_async(c);
38852f
+	if (daemon) {
38852f
+		if (conf->force_sync == 0)
38852f
+			checker_set_async(c);
38852f
+		else
38852f
+			checker_set_sync(c);
38852f
+	}
38852f
 	if (!conf->checker_timeout &&
38852f
 	    (pp->bus != SYSFS_BUS_SCSI ||
38852f
 	     sysfs_get_timeout(pp, &(c->timeout))))
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
@@ -214,6 +214,8 @@
38852f
 #	# values  : n > 0
38852f
 #	# default : determined by the OS
38852f
 #	dev_loss_tmo 600
38852f
+#
38852f
+#	#
38852f
 #	# name    : bindings_file
38852f
 #	# scope   : multipath
38852f
 #	# desc    : The location of the bindings file that is used with
38852f
@@ -222,6 +224,14 @@
38852f
 #	# default : "/var/lib/multipath/bindings"
38852f
 #	bindings_file "/etc/multipath_bindings"
38852f
 #
38852f
+#	#
38852f
+#	# name    : force_sync
38852f
+#	# scope   : multipathd
38852f
+#	# desc    : If set to yes, multipath will run all of the checkers in
38852f
+#	#           sync mode, even if the checker has an async mode.
38852f
+#	# values  : yes|no
38852f
+#	# default : no
38852f
+#	force_sync yes
38852f
 #}
38852f
 #	
38852f
 ##
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
@@ -411,6 +411,15 @@ modify an existing config, or create a n
38852f
 , the user device configs will be regular expression matched against the
38852f
 built-in configs instead. Default is
38852f
 .I no
38852f
+.TP
38852f
+.B force_sync
38852f
+If set to
38852f
+.I yes
38852f
+, multipathd will call the path checkers in sync mode only.  This means that
38852f
+only one checker will run at a time.  This is useful in the case where many
38852f
+multipathd checkers running in parallel causes significant CPU pressure. The
38852f
+Default is
38852f
+.I no
38852f
 .
38852f
 .SH "blacklist section"
38852f
 The