dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: bmarzins@sourceware.org
To: dm-cvs@sourceware.org, dm-devel@redhat.com
Subject: multipath-tools/multipathd main.c
Date: 7 Dec 2010 06:02:24 -0000	[thread overview]
Message-ID: <20101207060224.20389.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2010-12-07 06:02:24

Modified files:
	multipathd     : main.c 

Log message:
	Fix for bug 650801.  Multipathd wasn't checking checking all the paths to see
	if it needed to update the pathgroups after a new path came back online.
	This could lead to paths accidentally ending up in the wrong pathgroup.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/multipathd/main.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.69.2.30&r2=1.69.2.31

--- multipath-tools/multipathd/main.c	2010/09/08 21:40:30	1.69.2.30
+++ multipath-tools/multipathd/main.c	2010/12/07 06:02:23	1.69.2.31
@@ -937,14 +937,41 @@
 	return 0;
 }
 
-int update_path_groups(struct multipath *mpp, struct vectors *vecs)
+int update_prio(struct path *pp, int refresh_all)
+{
+	int oldpriority;
+	struct pathgroup * pgp;
+	int i, j, changed = 0;
+
+	if (refresh_all) {
+		vector_foreach_slot (pp->mpp->pg, pgp, i) {
+			vector_foreach_slot (pgp->paths, pp, j) {
+				oldpriority = pp->priority;
+				pathinfo(pp, conf->hwtable, DI_PRIO);
+				if (pp->priority != oldpriority)
+					changed = 1;
+			}
+		}
+		return changed;
+	}
+	oldpriority = pp->priority;
+	pathinfo(pp, conf->hwtable, DI_PRIO);
+
+	if (pp->priority == oldpriority)
+		return 0;
+	return 1;
+}
+
+int update_path_groups(struct multipath *mpp, struct vectors *vecs, int refresh)
 {
 	int i;
 	struct path * pp;
 
 	update_mpp_paths(mpp, vecs->pathvec);
-	vector_foreach_slot (mpp->paths, pp, i)
-		pathinfo(pp, conf->hwtable, DI_PRIO);
+	if (refresh) {
+		vector_foreach_slot (mpp->paths, pp, i)
+			pathinfo(pp, conf->hwtable, DI_PRIO);
+	}
 	setup_map(mpp);
 	mpp->action = ACT_RELOAD;
 	if (domap(mpp) <= 0) {
@@ -969,7 +996,6 @@
 	int newstate;
 	unsigned int i;
 	sigset_t old;
-	int oldpriority;
 
 	mlockall(MCL_CURRENT | MCL_FUTURE);
 	vecs = (struct vectors *)ap;
@@ -989,6 +1015,7 @@
 		condlog(4, "tick");
 
 		vector_foreach_slot (vecs->pathvec, pp, i) {
+			int new_path_up = 0;
 			if (!pp->mpp)
 				continue;
 
@@ -1081,16 +1108,7 @@
 					reinstate_path(pp, 1);
 				else
 					reinstate_path(pp, 0);
-
-				/*
-				 * schedule [defered] failback
-				 */
-				if (pp->mpp->pgfailback > 0)
-					pp->mpp->failback_tick =
-						pp->mpp->pgfailback + 1;
-				else if (pp->mpp->pgfailback == -FAILBACK_IMMEDIATE &&
-				    need_switch_pathgroup(pp->mpp, 1))
-					switch_pathgroup(pp->mpp);
+				new_path_up = 1;
 
 				/*
 				 * if at least one path is up in a group, and
@@ -1127,15 +1145,13 @@
 			 * path prio refreshing
 			 */
 			condlog(4, "path prio refresh");
-			oldpriority = pp->priority;
-			pathinfo(pp, conf->hwtable, DI_PRIO);
-
-			if (pp->priority != oldpriority &&
+			if (update_prio(pp, new_path_up) &&
 			    pp->mpp->pgpolicyfn == (pgpolicyfn *)group_by_prio)
-				update_path_groups(pp->mpp, vecs);
+				update_path_groups(pp->mpp, vecs, !new_path_up);
 			else if (need_switch_pathgroup(pp->mpp, 0)) {
 				if (pp->mpp->pgfailback > 0 &&
-				    pp->mpp->failback_tick <= 0)
+				    (new_path_up ||
+				     pp->mpp->failback_tick <= 0))
 					pp->mpp->failback_tick =
 						pp->mpp->pgfailback + 1;
 				else if (pp->mpp->pgfailback ==

             reply	other threads:[~2010-12-07  6:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-07  6:02 bmarzins [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-08-10 18:49 multipath-tools/multipathd main.c bmarzins
2012-08-07 19:37 bmarzins
2012-03-22 18:02 bmarzins
2011-10-24 13:46 bmarzins
2011-10-10  3:47 bmarzins
2011-04-11 17:01 bmarzins
2010-09-01 18:29 bmarzins
2010-08-09 16:16 bmarzins
2009-11-02 19:11 bmarzins
2009-09-10 16:27 bmarzins
2009-04-27 21:19 bmarzins
2008-10-17 18:37 bmarzins
2008-09-12 23:49 bmarzins
2008-09-04 23:31 bmarzins
2008-05-12 18:48 bmarzins
2007-04-26 17:47 bmarzins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101207060224.20389.qmail@sourceware.org \
    --to=bmarzins@sourceware.org \
    --cc=dm-cvs@sourceware.org \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).