Blame SOURCES/0083-RHBZ-1080055-orphan-paths-on-reload.patch

38852f
---
38852f
 libmultipath/structs_vec.c |   31 +++++++++++++++++++++++++++----
38852f
 multipathd/main.c          |    4 ++++
38852f
 2 files changed, 31 insertions(+), 4 deletions(-)
38852f
38852f
Index: multipath-tools-130222/libmultipath/structs_vec.c
38852f
===================================================================
38852f
--- multipath-tools-130222.orig/libmultipath/structs_vec.c
38852f
+++ multipath-tools-130222/libmultipath/structs_vec.c
38852f
@@ -280,12 +280,38 @@ update_multipath_status (struct multipat
38852f
 	return 0;
38852f
 }
38852f
 
38852f
+void sync_paths(struct multipath *mpp, vector pathvec)
38852f
+{
38852f
+	struct path *pp;
38852f
+	struct pathgroup  *pgp;
38852f
+	int found, i, j;
38852f
+
38852f
+	vector_foreach_slot (mpp->paths, pp, i) {
38852f
+		found = 0;
38852f
+		vector_foreach_slot(mpp->pg, pgp, j) {
38852f
+			if (find_slot(pgp->paths, (void *)pp) != -1) {
38852f
+				found = 1;
38852f
+				break;
38852f
+			}
38852f
+		}
38852f
+		if (!found) {
38852f
+			condlog(3, "%s dropped path %s", mpp->alias, pp->dev);
38852f
+			vector_del_slot(mpp->paths, i--);
38852f
+			orphan_path(pp);
38852f
+		}
38852f
+	}
38852f
+	update_mpp_paths(mpp, pathvec);
38852f
+	vector_foreach_slot (mpp->paths, pp, i)
38852f
+		pp->mpp = mpp;
38852f
+}
38852f
+
38852f
 extern int
38852f
 update_multipath_strings (struct multipath *mpp, vector pathvec)
38852f
 {
38852f
 	if (!mpp)
38852f
 		return 1;
38852f
 
38852f
+	update_mpp_paths(mpp, pathvec);
38852f
 	condlog(4, "%s: %s", mpp->alias, __FUNCTION__);
38852f
 
38852f
 	free_multipath_attributes(mpp);
38852f
@@ -294,6 +320,7 @@ update_multipath_strings (struct multipa
38852f
 
38852f
 	if (update_multipath_table(mpp, pathvec))
38852f
 		return 1;
38852f
+	sync_paths(mpp, pathvec);
38852f
 
38852f
 	if (update_multipath_status(mpp))
38852f
 		return 1;
38852f
@@ -494,13 +521,9 @@ int update_multipath (struct vectors *ve
38852f
 		return 2;
38852f
 	}
38852f
 
38852f
-	free_pgvec(mpp->pg, KEEP_PATHS);
38852f
-	mpp->pg = NULL;
38852f
-
38852f
 	if (__setup_multipath(vecs, mpp, reset))
38852f
 		return 1; /* mpp freed in setup_multipath */
38852f
 
38852f
-	adopt_paths(vecs->pathvec, mpp, 0);
38852f
 	/*
38852f
 	 * compare checkers states with DM states
38852f
 	 */
38852f
Index: multipath-tools-130222/multipathd/main.c
38852f
===================================================================
38852f
--- multipath-tools-130222.orig/multipathd/main.c
38852f
+++ multipath-tools-130222/multipathd/main.c
38852f
@@ -1152,6 +1152,10 @@ check_path (struct vectors * vecs, struc
38852f
 			pp->dev);
38852f
 		pp->dmstate = PSTATE_UNDEF;
38852f
 	}
38852f
+	/* if update_multipath_strings orphaned the path, quit early */
38852f
+	if (!pp->mpp)
38852f
+		return;
38852f
+
38852f
 	pp->chkrstate = newstate;
38852f
 	if (newstate != pp->state) {
38852f
 		int oldstate = pp->state;