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

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