Skip to contentSkip to conversation

Mulitpath: miscellaneous patches

PATCH In review Benjamin Marzinski 2 participants 11 messages Sep 2, 2021 – Sep 3, 2021 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

v2 cover Mulitpath: miscellaneous patches

Here are a couple of unconnected patches. They (at least libmultipath.version) are meant to be applied on top of Martin's recent patchset.

Changes from v1:

3/6: Reworked this to keep the logic in multipath, and prefix the output
with "Warning" as suggested by Martin Wilck.
6/6: New patch to simplify code that I noticed while reworking patch

     3/6.

Benjamin Marzinski (6):
multipath.conf: fix typo in ghost_delay description
mpathpersist: fail commands when no usable paths exist
multipath: print warning if multipathd is not running.
libmultipath: remove unneeded code in coalesce_paths
libmultipath: deal with dynamic PTHREAD_STACK_MIN
libmultipath: drop unnecessary parameter from remove_map()

 libmpathpersist/mpath_persist.c   | 10 ++++-
 libmultipath/configure.c          | 62 ++++---------------------------
 libmultipath/configure.h          |  1 +
 libmultipath/libmultipath.version |  5 +++
 libmultipath/structs_vec.c        | 12 +++---
 libmultipath/structs_vec.h        | 11 +-----
 libmultipath/util.c               |  4 +-
 multipath/main.c                  | 18 +++++++--
 multipath/multipath.conf.5        |  2 +-
 multipathd/dmevents.c             |  2 +-
 multipathd/main.c                 | 12 +++---
 11 files changed, 54 insertions(+), 85 deletions(-)
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
author maintainer
#1 lore raw

PATCH v2 1/6 multipath.conf: fix typo in ghost_delay description

---
 multipath/multipath.conf.5 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
multipath/multipath.conf.5 +1 -1
index 064e4826..d6b8c7f6 100644
@@ -1251,7 +1251,7 @@ The default is: in \fB/sys/block/<dev>/queue/max_sectors_kb\fR
 Sets the number of seconds that multipath will wait after creating a device
 with only ghost paths before marking it ready for use in systemd. This gives
 the active paths time to appear before the multipath runs the hardware handler
-to switch the ghost paths to active ones. Setting this to \fI0\fR or \fIon\fR
+to switch the ghost paths to active ones. Setting this to \fI0\fR or \fIno\fR
 makes multipath immediately mark a device with only ghost paths as ready.
 .RS
 .TP
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
author maintainer
#2 lore raw

PATCH v2 2/6 mpathpersist: fail commands when no usable paths exist

In reply to Benjamin Marzinski

"mpathpersist -oCK <reservation_key> <device>" will return success if it is run on devices with no usable paths, but nothing is actually done. The -L command will fail, but it should give up sooner, and with a more helpful error message.

---
 libmpathpersist/mpath_persist.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
libmpathpersist/mpath_persist.c +7 -1
index 190e9707..26710e79 100644
@@ -604,7 +604,8 @@ int mpath_prout_common(struct multipath *mpp,int rq_servact, int rq_scope,
 			return ret ;
 		}
 	}
-	return MPATH_PR_SUCCESS;
+	condlog (0, "%s: no path available", mpp->wwid);
+	return MPATH_PR_DMMP_ERROR;
 }
 
 int send_prout_activepath(char * dev, int rq_servact, int rq_scope,
@@ -663,6 +664,11 @@ int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope,
 
 	active_pathcount = count_active_paths(mpp);
 
+	if (active_pathcount == 0) {
+		condlog (0, "%s: no path available", mpp->wwid);
+		return MPATH_PR_DMMP_ERROR;
+	}
+
 	struct threadinfo thread[active_pathcount];
 	memset(thread, 0, sizeof(thread));
 	for (i = 0; i < active_pathcount; i++){
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
author maintainer
#3 lore raw

PATCH v2 3/6 multipath: print warning if multipathd is not running.

In reply to Benjamin Marzinski

If multipath notices that multipath devices exist or were created, and multipathd is not running, it now prints a warning message, so users are notified of the issue.

---
 libmultipath/configure.c          |  3 ++-
 libmultipath/configure.h          |  1 +
 libmultipath/libmultipath.version |  5 +++++
 multipath/main.c                  | 14 ++++++++++++--
 4 files changed, 20 insertions(+), 3 deletions(-)
libmultipath/configure.c +2 -1
index 12278640..2f417914 100644
@@ -1082,7 +1082,8 @@ deadmap (struct multipath * mpp)
 	return 1; /* dead */
 }
 
-int check_daemon(void)
+extern int
+check_daemon(void)
 {
 	int fd;
 	char *reply;
libmultipath/configure.h +1 -0
index 92a5aba6..efe18b7d 100644
@@ -59,3 +59,4 @@ struct udev_device *get_udev_device(const char *dev, enum devtypes dev_type);
 void trigger_paths_udev_change(struct multipath *mpp, bool is_mpath);
 void trigger_partitions_udev_change(struct udev_device *dev, const char *action,
 				    int len);
+int check_daemon(void);
libmultipath/libmultipath.version +5 -0
index 1d84d97c..7b48265f 100644
@@ -285,3 +285,8 @@ global:
 	print_strbuf;
 	truncate_strbuf;
 } LIBMULTIPATH_8.0.0;
+
+LIBMULTIPATH_8.2.0 {
+global:
+	check_daemon;
+} LIBMULTIPATH_8.1.0;
multipath/main.c +12 -2
index 8fc0e15f..6c70760f 100644
@@ -456,6 +456,7 @@ configure (struct config *conf, enum mpath_cmds cmd,
 {
 	vector curmp = NULL;
 	vector pathvec = NULL;
+	vector newmp = NULL;
 	int r = RTVL_FAIL, rc;
 	int di_flag = 0;
 	char * refwwid = NULL;
@@ -466,8 +467,9 @@ configure (struct config *conf, enum mpath_cmds cmd,
 	 */
 	curmp = vector_alloc();
 	pathvec = vector_alloc();
+	newmp = vector_alloc();
 
-	if (!curmp || !pathvec) {
+	if (!curmp || !pathvec || !newmp) {
 		condlog(0, "can not allocate memory");
 		goto out;
 	}
@@ -569,16 +571,24 @@ configure (struct config *conf, enum mpath_cmds cmd,
 	/*
 	 * core logic entry point
 	 */
-	rc = coalesce_paths(&vecs, NULL, refwwid,
+	rc = coalesce_paths(&vecs, newmp, refwwid,
 			   conf->force_reload, cmd);
 	r = rc == CP_RETRY ? RTVL_RETRY : rc == CP_OK ? RTVL_OK : RTVL_FAIL;
 
 out:
+	if (r == RTVL_OK &&
+	    (cmd == CMD_LIST_SHORT || cmd == CMD_LIST_LONG ||
+	     cmd == CMD_CREATE) &&
+	    (VECTOR_SIZE(curmp) > 0 || VECTOR_SIZE(newmp) > 0) &&
+	    !check_daemon())
+		condlog(2, "Warning: multipath devices exist, but multipathd service is not running");
+
 	if (refwwid)
 		FREE(refwwid);
 
 	free_multipathvec(curmp, KEEP_PATHS);
 	vecs.mpvec = NULL;
+	free_multipathvec(newmp, KEEP_PATHS);
 	free_pathvec(pathvec, FREE_PATHS);
 	vecs.pathvec = NULL;
 
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Reviewed-by on v2 3/6
#4 lore raw

Re: [dm-devel] [PATCH v2 3/6] multipath: print warning if multipathd is not running.

Quoted 6 lines · Benjamin Marzinski

If multipath notices that multipath devices exist or were created, and multipathd is not running, it now prints a warning message, so users are
notified of the issue.

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

author maintainer
#5 lore raw

PATCH v2 4/6 libmultipath: remove unneeded code in coalesce_paths

In reply to Benjamin Marzinski

The code at the end of coalesce_paths() removes a multipath device that was just created/reloaded, if none of its path devices have pp->dev set. This code is very old, and no longer has any actual effect. Multipath devices no longer get placed in pathvec without having pp->dev set. Even if they could, there's no point in creating/reloading the device and then immediately removing it.

---
 libmultipath/configure.c | 46 ----------------------------------------
 1 file changed, 46 deletions(-)
libmultipath/configure.c +0 -46
index 2f417914..3f241c5c 100644
@@ -1060,28 +1060,6 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
 	return DOMAP_FAIL;
 }
 
-static int
-deadmap (struct multipath * mpp)
-{
-	int i, j;
-	struct pathgroup * pgp;
-	struct path * pp;
-
-	if (!mpp->pg)
-		return 1;
-
-	vector_foreach_slot (mpp->pg, pgp, i) {
-		if (!pgp->paths)
-			continue;
-
-		vector_foreach_slot (pgp->paths, pp, j)
-			if (strlen(pp->dev))
-				return 0; /* alive */
-	}
-
-	return 1; /* dead */
-}
-
 extern int
 check_daemon(void)
 {
@@ -1313,30 +1291,6 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
 			remove_map(mpp, vecs->pathvec, vecs->mpvec,
 				   KEEP_VEC);
 	}
-	/*
-	 * Flush maps with only dead paths (ie not in sysfs)
-	 * Keep maps with only failed paths
-	 */
-	if (mpvec) {
-		vector_foreach_slot (newmp, mpp, i) {
-			char alias[WWID_SIZE];
-
-			if (!deadmap(mpp))
-				continue;
-
-			strlcpy(alias, mpp->alias, WWID_SIZE);
-
-			vector_del_slot(newmp, i);
-			i--;
-			remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC);
-
-			if (dm_flush_map(alias))
-				condlog(2, "%s: remove failed (dead)",
-					alias);
-			else
-				condlog(2, "%s: remove (dead)", alias);
-		}
-	}
 	ret = CP_OK;
 out:
 	free(size_mismatch_seen);
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
author maintainer
#6 lore raw

PATCH v2 5/6 libmultipath: deal with dynamic PTHREAD_STACK_MIN

In reply to Benjamin Marzinski

Starting in glibc-2.34 (commit 5d98a7da), PTHREAD_STACK_MIN is defined as sysconf(_SC_THREAD_STACK_MIN) if _GNU_SOURCE is defined. sysconf() returns a long and can, at least in theory, return -1. This change causes compilation to fail in setup_thread_attr() due to a comparision with different signedness, since stacksize is a size_t.

---
 libmultipath/util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
libmultipath/util.c +2 -2
index e2fafe85..ea858409 100644
@@ -223,8 +223,8 @@ setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached)
 
 	ret = pthread_attr_init(attr);
 	assert(ret == 0);
-	if (stacksize < PTHREAD_STACK_MIN)
-		stacksize = PTHREAD_STACK_MIN;
+	if (PTHREAD_STACK_MIN > 0 && stacksize < (size_t)PTHREAD_STACK_MIN)
+		stacksize = (size_t)PTHREAD_STACK_MIN;
 	ret = pthread_attr_setstacksize(attr, stacksize);
 	assert(ret == 0);
 	if (detached) {
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
author maintainer
#7 lore raw

PATCH v2 6/6 libmultipath: drop unnecessary parameter from remove_map()

In reply to Benjamin Marzinski

When remove_map() is called, if the multipath device is in a mpvec, it must be removed from it, because the device will be freed. Now that the mpvec is passed as a separate parameter to remove_map(), the purge_vec parameter is redundant. It was only used by coalesce_paths(), since the multipath device isn't on any vector when remove_map() is called there. Instead, remove_map() can just be called with a NULL mpvec, when there is no mpvec to remove the device from.

remove_map_by_alias() also has a redundant purge_vec parameter. Since it only removes a map if it finds in on vec->mpvec, calling it with KEEP_VEC would be a bug, since it would leave a pointer to the freed device in the vector.

---
 libmpathpersist/mpath_persist.c |  2 +-
 libmultipath/configure.c        | 13 ++++++-------
 libmultipath/structs_vec.c      | 12 ++++++------
 libmultipath/structs_vec.h      | 11 ++---------
 multipath/main.c                |  4 ++--
 multipathd/dmevents.c           |  2 +-
 multipathd/main.c               | 12 ++++++------
 7 files changed, 24 insertions(+), 32 deletions(-)
libmpathpersist/mpath_persist.c +1 -1
index 26710e79..803a2a28 100644
@@ -410,7 +410,7 @@ get_mpvec (vector curmp, vector pathvec, char * refwwid)
 		if (update_multipath_table(mpp, pathvec, DI_CHECKER) != DMP_OK ||
 		    update_mpp_paths(mpp, pathvec)) {
 			condlog(1, "error parsing map %s", mpp->wwid);
-			remove_map(mpp, pathvec, curmp, PURGE_VEC);
+			remove_map(mpp, pathvec, curmp);
 			i--;
 		} else
 			extract_hwe_from_path(mpp);
libmultipath/configure.c +6 -7
index 3f241c5c..7edb355b 100644
@@ -1198,7 +1198,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
 
 		if (!mpp->paths) {
 			condlog(0, "%s: skip coalesce (no paths)", mpp->alias);
-			remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC);
+			remove_map(mpp, vecs->pathvec, NULL);
 			continue;
 		}
 
@@ -1226,7 +1226,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
 		verify_paths(mpp);
 
 		if (setup_map(mpp, &params, vecs)) {
-			remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC);
+			remove_map(mpp, vecs->pathvec, NULL);
 			continue;
 		}
 
@@ -1248,7 +1248,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
 				condlog(2, "%s: %s map",
 					mpp->alias, (mpp->action == ACT_CREATE)?
 					"ignoring" : "removing");
-				remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC);
+				remove_map(mpp, vecs->pathvec, NULL);
 				continue;
 			} else /* if (r == DOMAP_RETRY && !is_daemon) */ {
 				ret = CP_RETRY;
@@ -1257,7 +1257,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
 		}
 		if (r == DOMAP_DRY) {
 			if (!vector_alloc_slot(newmp)) {
-				remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC);
+				remove_map(mpp, vecs->pathvec, NULL);
 				goto out;
 			}
 			vector_set_slot(newmp, mpp);
@@ -1282,14 +1282,13 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
 
 		if (mpp->action != ACT_REJECT) {
 			if (!vector_alloc_slot(newmp)) {
-				remove_map(mpp, vecs->pathvec, vecs->mpvec, KEEP_VEC);
+				remove_map(mpp, vecs->pathvec, NULL);
 				goto out;
 			}
 			vector_set_slot(newmp, mpp);
 		}
 		else
-			remove_map(mpp, vecs->pathvec, vecs->mpvec,
-				   KEEP_VEC);
+			remove_map(mpp, vecs->pathvec, NULL);
 	}
 	ret = CP_OK;
 out:
libmultipath/structs_vec.c +6 -6
index 24d6fd24..85d97ac1 100644
@@ -334,7 +334,7 @@ void set_path_removed(struct path *pp)
 }
 
 void
-remove_map(struct multipath *mpp, vector pathvec, vector mpvec, int purge_vec)
+remove_map(struct multipath *mpp, vector pathvec, vector mpvec)
 {
 	int i;
 
@@ -343,7 +343,7 @@ remove_map(struct multipath *mpp, vector pathvec, vector mpvec, int purge_vec)
 	 */
 	orphan_paths(pathvec, mpp, "map removed internally");
 
-	if (purge_vec &&
+	if (mpvec &&
 	    (i = find_slot(mpvec, (void *)mpp)) != -1)
 		vector_del_slot(mpvec, i);
 
@@ -354,12 +354,12 @@ remove_map(struct multipath *mpp, vector pathvec, vector mpvec, int purge_vec)
 }
 
 void
-remove_map_by_alias(const char *alias, struct vectors * vecs, int purge_vec)
+remove_map_by_alias(const char *alias, struct vectors * vecs)
 {
 	struct multipath * mpp = find_mp_by_alias(vecs->mpvec, alias);
 	if (mpp) {
 		condlog(2, "%s: removing map by alias", alias);
-		remove_map(mpp, vecs->pathvec, vecs->mpvec, purge_vec);
+		remove_map(mpp, vecs->pathvec, vecs->mpvec);
 	}
 }
 
@@ -373,7 +373,7 @@ remove_maps(struct vectors * vecs)
 		return;
 
 	vector_foreach_slot (vecs->mpvec, mpp, i) {
-		remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC);
+		remove_map(mpp, vecs->pathvec, vecs->mpvec);
 		i--;
 	}
 
@@ -704,7 +704,7 @@ struct multipath *add_map_with_path(struct vectors *vecs, struct path *pp,
 	return mpp;
 
 out:
-	remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC);
+	remove_map(mpp, vecs->pathvec, vecs->mpvec);
 	return NULL;
 }
 
libmultipath/structs_vec.h +2 -9
index ee2b723b..29ede454 100644
@@ -27,15 +27,8 @@ int update_mpp_paths(struct multipath * mpp, vector pathvec);
 int update_multipath_strings (struct multipath *mpp, vector pathvec);
 void extract_hwe_from_path(struct multipath * mpp);
 
-enum {
-	KEEP_VEC,
-	PURGE_VEC,
-};
-
-void remove_map (struct multipath *mpp, vector pathvec, vector mpvec,
-		 int purge_vec);
-void remove_map_by_alias(const char *alias, struct vectors * vecs,
-			 int purge_vec);
+void remove_map (struct multipath *mpp, vector pathvec, vector mpvec);
+void remove_map_by_alias(const char *alias, struct vectors * vecs);
 void remove_maps (struct vectors * vecs);
 
 void sync_map_state (struct multipath *);
multipath/main.c +2 -2
index 6c70760f..65ece830 100644
@@ -191,14 +191,14 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)
 		if (refwwid && strlen(refwwid) &&
 		    strncmp(mpp->wwid, refwwid, WWID_SIZE)) {
 			condlog(3, "skip map %s: out of scope", mpp->alias);
-			remove_map(mpp, pathvec, curmp, PURGE_VEC);
+			remove_map(mpp, pathvec, curmp);
 			i--;
 			continue;
 		}
 
 		if (update_multipath_table(mpp, pathvec, flags) != DMP_OK) {
 			condlog(1, "error parsing map %s", mpp->wwid);
-			remove_map(mpp, pathvec, curmp, PURGE_VEC);
+			remove_map(mpp, pathvec, curmp);
 			i--;
 			continue;
 		}
multipathd/dmevents.c +1 -1
index f52f5970..f035ee7f 100644
@@ -359,7 +359,7 @@ static int dmevent_loop (void)
 		pthread_testcancel();
 		r = 0;
 		if (curr_dev.action == EVENT_REMOVE)
-			remove_map_by_alias(curr_dev.name, waiter->vecs, PURGE_VEC);
+			remove_map_by_alias(curr_dev.name, waiter->vecs);
 		else
 			r = update_multipath(waiter->vecs, curr_dev.name, 1);
 		pthread_cleanup_pop(1);
multipathd/main.c +6 -6
index ae8272e3..3aff241d 100644
@@ -385,7 +385,7 @@ remove_map_and_stop_waiter(struct multipath *mpp, struct vectors *vecs)
 	condlog(3, "%s: removing map from internal tables", mpp->alias);
 	if (!poll_dmevents)
 		stop_waiter_thread(mpp);
-	remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC);
+	remove_map(mpp, vecs->pathvec, vecs->mpvec);
 }
 
 static void
@@ -518,7 +518,7 @@ retry:
 fail:
 	if (new_map && (retries < 0 || wait_for_events(mpp, vecs))) {
 		condlog(0, "%s: failed to create new map", mpp->alias);
-		remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC);
+		remove_map(mpp, vecs->pathvec, vecs->mpvec);
 		return 1;
 	}
 
@@ -572,7 +572,7 @@ add_map_without_path (struct vectors *vecs, const char *alias)
 
 	return mpp;
 out:
-	remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC);
+	remove_map(mpp, vecs->pathvec, vecs->mpvec);
 	return NULL;
 }
 
@@ -1162,7 +1162,7 @@ rescan:
 		goto fail;
 
 fail_map:
-	remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC);
+	remove_map(mpp, vecs->pathvec, vecs->mpvec);
 fail:
 	orphan_path(pp, "failed to add path");
 	return 1;
@@ -1469,7 +1469,7 @@ map_discovery (struct vectors * vecs)
 
 	vector_foreach_slot (vecs->mpvec, mpp, i)
 		if (update_multipath_table(mpp, vecs->pathvec, 0) != DMP_OK) {
-			remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC);
+			remove_map(mpp, vecs->pathvec, vecs->mpvec);
 			i--;
 		}
 
@@ -2706,7 +2706,7 @@ configure (struct vectors * vecs)
 	 */
 	vector_foreach_slot(vecs->mpvec, mpp, i) {
 		if (wait_for_events(mpp, vecs)) {
-			remove_map(mpp, vecs->pathvec, vecs->mpvec, PURGE_VEC);
+			remove_map(mpp, vecs->pathvec, vecs->mpvec);
 			i--;
 			continue;
 		}
Signature · 6 lines
2.17.2

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Reviewed-by on v2 6/6
#8 lore raw

Re: [dm-devel] [PATCH v2 6/6] libmultipath: drop unnecessary parameter from remove_map()

Quoted 14 lines · Benjamin Marzinski

When remove_map() is called, if the multipath device is in a mpvec, it
must be removed from it, because the device will be freed. Now that the
mpvec is passed as a separate parameter to remove_map(), the purge_vec
parameter is redundant.  It was only used by coalesce_paths(), since the
multipath device isn't on any vector when remove_map() is called there.
Instead, remove_map() can just be called with a NULL mpvec, when there
is no mpvec to remove the device from.

Quoted 7 lines

remove_map_by_alias() also has a redundant purge_vec parameter. Since
it only removes a map if it finds in on vec->mpvec, calling it with KEEP_VEC would be a bug, since it would leave a pointer to the freed device in the vector.

Good catch. But we need to adapt libmultipath.version. I'll send a fix to be added on top.

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

#9 lore raw

Re: [dm-devel] [PATCH v2 6/6] libmultipath: drop unnecessary parameter from remove_map()

Quoted 23 lines · Martin Wilck
Quoted 22 lines · Benjamin Marzinski

When remove_map() is called, if the multipath device is in a mpvec, it
must be removed from it, because the device will be freed. Now that the
mpvec is passed as a separate parameter to remove_map(), the purge_vec
parameter is redundant.  It was only used by coalesce_paths(), since
the
multipath device isn't on any vector when remove_map() is called there.
Instead, remove_map() can just be called with a NULL mpvec, when there
is no mpvec to remove the device from.

remove_map_by_alias() also has a redundant purge_vec parameter. Since
it only removes a map if it finds in on vec->mpvec, calling it with KEEP_VEC would be a bug, since it would leave a pointer to the freed
device in the vector.

Quoted 7 lines
Quoted 1 line

Good catch. But we need to adapt libmultipath.version. I'll send a fix
to be added on top.

This breaks the directio test, too. We need a test patch on top. I'm going to post it.

Martin

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel

author maintainer
#10 lore raw

Re: [dm-devel] [PATCH v2 6/6] libmultipath: drop unnecessary parameter from remove_map()

Quoted 26 lines · Martin Wilck
Quoted 25 lines · Martin Wilck
Quoted 23 lines · Benjamin Marzinski

When remove_map() is called, if the multipath device is in a mpvec, it
must be removed from it, because the device will be freed. Now that the
mpvec is passed as a separate parameter to remove_map(), the purge_vec
parameter is redundant.  It was only used by coalesce_paths(), since
the
multipath device isn't on any vector when remove_map() is called there.
Instead, remove_map() can just be called with a NULL mpvec, when there
is no mpvec to remove the device from.

remove_map_by_alias() also has a redundant purge_vec parameter. Since
it only removes a map if it finds in on vec->mpvec, calling it with KEEP_VEC would be a bug, since it would leave a pointer to the freed
device in the vector.

Quoted 8 lines
Quoted 5 lines

Good catch. But we need to adapt libmultipath.version. I'll send a fix
to be added on top.

This breaks the directio test, too. We need a test patch on top. I'm going to post it.

Oops. Thanks.

-Ben

Quoted 2 lines

Martin

--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel