diff mbox

multipath-tools/multipathd main.c

Message ID 20100901182919.24882.qmail@sourceware.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

bmarzins@sourceware.org Sept. 1, 2010, 6:29 p.m. UTC
None
diff mbox

Patch

--- multipath-tools/multipathd/main.c	2010/08/09 16:16:10	1.69.2.28
+++ multipath-tools/multipathd/main.c	2010/09/01 18:29:18	1.69.2.29
@@ -52,6 +52,7 @@ 
 #include <switchgroup.h>
 #include <print.h>
 #include <configure.h>
+#include <pgpolicies.h>
 
 #include "main.h"
 #include "pidfile.h"
@@ -933,6 +934,29 @@ 
 	return 0;
 }
 
+int update_path_groups(struct multipath *mpp, struct vectors *vecs)
+{
+	int i;
+	struct path * pp;
+
+	update_mpp_paths(mpp, vecs->pathvec);
+	vector_foreach_slot (mpp->paths, pp, i)
+		pathinfo(pp, conf->hwtable, DI_PRIO);
+	setup_map(mpp);
+	mpp->action = ACT_RELOAD;
+	if (domap(mpp) <= 0) {
+		condlog(0, "%s: failed to update map : %s", mpp->alias,
+				strerror(errno));
+		return 1;
+	}
+	dm_lib_release();
+	setup_multipath(vecs, mpp);
+	sync_map_state(mpp);
+
+	return 0;
+}
+
+
 static void *
 checkerloop (void *ap)
 {
@@ -942,6 +966,7 @@ 
 	int newstate;
 	unsigned int i;
 	sigset_t old;
+	int oldpriority;
 
 	mlockall(MCL_CURRENT | MCL_FUTURE);
 	vecs = (struct vectors *)ap;
@@ -1095,9 +1120,13 @@ 
 			 * path prio refreshing
 			 */
 			condlog(4, "path prio refresh");
+			oldpriority = pp->priority;
 			pathinfo(pp, conf->hwtable, DI_PRIO);
 
-			if (need_switch_pathgroup(pp->mpp, 0)) {
+			if (pp->priority != oldpriority &&
+			    pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio)
+				update_path_groups(pp->mpp, vecs);
+			else if (need_switch_pathgroup(pp->mpp, 0)) {
 				if (pp->mpp->pgfailback > 0 &&
 				    pp->mpp->failback_tick <= 0)
 					pp->mpp->failback_tick =