Skip to contentSkip to conversation

Rebased multipath-tools patches

PATCH New Martin Wilck 1 participant 4 messages Oct 2, 2019 Device mapper

lore
Share & tools
lore
#0 lore raw

cover Rebased multipath-tools patches

From: Martin Wilck <[email protected]>

Hi Christophe,

here are the three patches that needed rebasing after your last merge.

Regards,
Martin

Chongyun Wu (1):
multipathd: "san_path_err" failure optimization

Martin Wilck (2):
multipath.conf: add "enable_foreign" parameter multipath.conf.5: document foreign library support

 libmultipath/config.h      |  1 +
 libmultipath/defaults.h    |  2 ++
 libmultipath/dict.c        |  6 +++++
 libmultipath/foreign.c     | 53 +++++++++++++++++++++++++++++++++++---
 libmultipath/foreign.h     |  3 ++-
 multipath/main.c           |  2 +-
 multipath/multipath.conf.5 | 40 ++++++++++++++++++++++++++++
 multipathd/main.c          | 19 +++++++++++++-
 8 files changed, 119 insertions(+), 7 deletions(-)
Signature · 1 line
2.23.0
#1 lore raw

PATCH 1/3 multipath.conf: add "enable_foreign" parameter

From: Martin Wilck <[email protected]>

This new configuration parameter can be used to selectively enable foreign libraries. The value is a regular expression, against which foreign library names such as "nvme" are matched. By setting this to a value that matches no foreign library (e.g. "^$" or "NONE"), foreign code is completely disabled. By default, all available foreign libraries are loaded.

---
 libmultipath/config.h   |  1 +
 libmultipath/defaults.h |  2 ++
 libmultipath/dict.c     |  6 +++++
 libmultipath/foreign.c  | 53 +++++++++++++++++++++++++++++++++++++----
 libmultipath/foreign.h  |  3 ++-
 multipath/main.c        |  2 +-
 multipathd/main.c       |  2 +-
 7 files changed, 62 insertions(+), 7 deletions(-)
libmultipath/config.h +1 -0
index 0b978970..ffec3103 100644
@@ -225,6 +225,7 @@ struct config {
 	vector elist_device;
 	vector elist_property;
 	vector elist_protocol;
+	char *enable_foreign;
 };
 
 extern struct udev * udev;
libmultipath/defaults.h +2 -0
index decc9335..4dfe007c 100644
@@ -48,6 +48,8 @@
 #define DEFAULT_FIND_MULTIPATHS_TIMEOUT -10
 #define DEFAULT_UNKNOWN_FIND_MULTIPATHS_TIMEOUT 1
 #define DEFAULT_ALL_TG_PT ALL_TG_PT_OFF
+/* Enable all foreign libraries by default */
+#define DEFAULT_ENABLE_FOREIGN ""
 
 #define CHECKINT_UNDEF		(~0U)
 #define DEFAULT_CHECKINT	5
libmultipath/dict.c +6 -0
index b5feb884..2b046e1d 100644
@@ -610,6 +610,10 @@ declare_def_handler(find_multipaths_timeout, set_int)
 declare_def_snprint_defint(find_multipaths_timeout, print_int,
 			   DEFAULT_FIND_MULTIPATHS_TIMEOUT)
 
+declare_def_handler(enable_foreign, set_str)
+declare_def_snprint_defstr(enable_foreign, print_str,
+			   DEFAULT_ENABLE_FOREIGN)
+
 static int
 def_config_dir_handler(struct config *conf, vector strvec)
 {
@@ -1712,6 +1716,8 @@ init_keywords(vector keywords)
 	install_keyword("find_multipaths_timeout",
 			&def_find_multipaths_timeout_handler,
 			&snprint_def_find_multipaths_timeout);
+	install_keyword("enable_foreign", &def_enable_foreign_handler,
+			&snprint_def_enable_foreign);
 	install_keyword("marginal_pathgroups", &def_marginal_pathgroups_handler, &snprint_def_marginal_pathgroups);
 	__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
 	__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
libmultipath/foreign.c +49 -4

102 lines not on this page · raw message

libmultipath/foreign.h +2 -1
index 697f12f8..acd33601 100644
@@ -195,9 +195,10 @@ struct foreign {
  * init_foreign(dir)
  * load and initialize foreign multipath libraries in dir (libforeign-*.so).
  * @param dir: directory to search
+ * @param enable: regex to match foreign library name ("*" above) against
  * @returns: 0 on success, negative value on failure.
  */
-int init_foreign(const char *multipath_dir);
+int init_foreign(const char *multipath_dir, const char *enable);
 
 /**
  * cleanup_foreign(dir)
multipath/main.c +1 -1
index 96a11468..4f4d8e89 100644
@@ -1050,7 +1050,7 @@ main (int argc, char *argv[])
 		goto out;
 	}
 	/* Failing here is non-fatal */
-	init_foreign(conf->multipath_dir);
+	init_foreign(conf->multipath_dir, conf->enable_foreign);
 	if (cmd == CMD_USABLE_PATHS) {
 		r = check_usable_paths(conf, dev, dev_type) ?
 			RTVL_FAIL : RTVL_OK;
multipathd/main.c +1 -1
index f7a57c74..70172d71 100644
@@ -2840,7 +2840,7 @@ child (void * param)
 	}
 	/* Failing this is non-fatal */
 
-	init_foreign(conf->multipath_dir);
+	init_foreign(conf->multipath_dir, conf->enable_foreign);
 
 	if (poll_dmevents)
 		poll_dmevents = dmevent_poll_supported();
Signature · 1 line
2.23.0
#2 lore raw

PATCH 2/3 multipath.conf.5: document foreign library support

In reply to Martin Wilck

From: Martin Wilck <[email protected]>

Add documentation for foreign library support, and for the "enable_foreign" parameter.

---
 multipath/multipath.conf.5 | 40 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
multipath/multipath.conf.5 +40 -0
index 23a79e9b..e866da23 100644
@@ -1220,6 +1220,21 @@ makes multipath immediately mark a device with only ghost paths as ready.
 The default is: \fBno\fR
 .RE
 .
+.
+.TP
+.B enable_foreign
+Enables or disables foreign libraries (see section
+.I FOREIGN MULTIPATH SUPPORT
+below). The value is a regular expression; foreign libraries are loaded
+if their name (e.g. \(dqnvme\(dq) matches the expression. By default,
+all foreign libraries are enabled.
+.RS
+.TP
+The default is: \fB\(dq\(dq\fR (the empty regular expression)
+.RE
+.
+.
+
 .
 .\" ----------------------------------------------------------------------------
 .SH "blacklist and blacklist_exceptions sections"
@@ -1763,6 +1778,31 @@ unpredictable ways. If the \(dqmarginal_path\(dq method is active, the
 .
 .
 .\" ----------------------------------------------------------------------------
+.SH "FOREIGN MULTIPATH SUPPORT"
+.\" ----------------------------------------------------------------------------
+.
+multipath and multipathd can load \(dqforeign\(dq libraries to add
+support for other multipathing technologies besides the Linux device mapper.
+Currently this support is limited to printing detected information about
+multipath setup. In topology output, the names of foreign maps are prefixed by
+the foreign library name in square brackets, as in this example:
+.
+.P
+.EX
+# multipath -ll
+uuid.fedcba98-3579-4567-8765-123456789abc [nvme]:nvme4n9 NVMe,Some NVMe controller,FFFFFFFF
+size=167772160 features='n/a' hwhandler='ANA' wp=rw
+|-+- policy='n/a' prio=50 status=optimized
+| `- 4:38:1    nvme4c38n1 0:0     n/a   optimized    live
+`-+- policy='n/a' prio=50 status=optimized
+  `- 4:39:1    nvme4c39n1 0:0     n/a   optimized    live
+.EE
+.
+.P
+The \(dqnvme\(dq foreign library provides support for NVMe native multipathing
+in the kernel. It is part of the standard multipath package.
+.
+.\" ----------------------------------------------------------------------------
 .SH "KNOWN ISSUES"
 .\" ----------------------------------------------------------------------------
 .
Signature · 1 line
2.23.0
#3 lore raw

PATCH 3/3 multipathd: "san_path_err" failure optimization

In reply to Martin Wilck

From: Chongyun Wu <[email protected]>

Let san_path_err_recovery_time path unstable can be detected and not reinstate it until this path keep up in san_path_err_recovery_time. It will fix heavy IO delay caused by parts of paths state shaky in multipath device.

Test and result:
Run up eth1 30s and down eth1 30s with 100 loops script to make some paths shaky in each multipath devices.
Using below multipath.conf configure in defaults section:
san_path_err_recovery_time 30
san_path_err_threshold 2
san_path_err_forget_rate 6
After test, not found any IO delay logs except several logs in the very beginning which before san_path_err filter shaky path works . If without above config and this patch there will be lots of IO delay in syslog and some paths state change from up to down again and again.

---
 multipathd/main.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
multipathd/main.c +17 -0
index 70172d71..34a57689 100644
@@ -1896,6 +1896,18 @@ static int check_path_reinstate_state(struct path * pp) {
 			goto reinstate_path;
 		}
 		get_monotonic_time(&curr_time);
+
+		/* If path became failed again or continue failed, should reset
+		 * path san_path_err_forget_rate and path dis_reinstate_time to
+		 * start a new stable check. 
+		 */
+		if ((pp->state != PATH_UP) && (pp->state != PATH_GHOST) &&
+			(pp->state != PATH_DELAYED)) {
+			pp->san_path_err_forget_rate =
+				pp->mpp->san_path_err_forget_rate;
+			pp->dis_reinstate_time = curr_time.tv_sec;
+		}
+
 		if ((curr_time.tv_sec - pp->dis_reinstate_time ) > pp->mpp->san_path_err_recovery_time) {
 			condlog(2,"%s : reinstate the path after err recovery time", pp->dev);
 			goto reinstate_path;
@@ -2066,6 +2078,11 @@ check_path (struct vectors * vecs, struct path * pp, int ticks)
 		pathinfo(pp, conf, 0);
 		pthread_cleanup_pop(1);
 		return 1;
+	} else if ((newstate != PATH_UP && newstate != PATH_GHOST) &&
+			(pp->state == PATH_DELAYED)) {
+		/* If path state become failed again cancel path delay state */
+		pp->state = newstate;
+		return 1;
 	}
 	if (!pp->mpp) {
 		if (!strlen(pp->wwid) &&
Signature · 1 line
2.23.0