[dm-devel] [RFC PATCH 04/16] libmultipath: should_multipath: keep existing maps

Martin Wilck mwilck at suse.com
Fri Jan 19 00:29:04 UTC 2018


If with find_multipaths and !ignore_new_devs, if a path is already
multipathed, keep it. The same logic is applied in multipath -u
with ignore_wwids.
---
 libmultipath/wwids.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libmultipath/wwids.c b/libmultipath/wwids.c
index fcbf5281b491..828a3de5b5cb 100644
--- a/libmultipath/wwids.c
+++ b/libmultipath/wwids.c
@@ -287,6 +287,13 @@ should_multipath(struct path *pp1, vector pathvec, vector mpvec)
 
 	condlog(4, "checking if %s should be multipathed", pp1->dev);
 	if (!ignore_new_devs) {
+		struct multipath *mp = find_mp_by_wwid(mpvec, pp1->wwid);
+
+		if (mp != NULL && first_path(mp) != NULL) {
+			condlog(3, "wwid %s is already multipathed, keeping it",
+				pp1->wwid);
+			return 1;
+		}
 		vector_foreach_slot(pathvec, pp2, i) {
 			if (pp1->dev == pp2->dev)
 				continue;
-- 
2.15.1




More information about the dm-devel mailing list