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

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