All of lore.kernel.org
 help / color / mirror / Atom feed
From: bmarzins@sourceware.org
To: dm-cvs@sourceware.org, dm-devel@redhat.com
Subject: multipath-tools/libmultipath pgpolicies.c
Date: 16 Dec 2009 05:31:51 -0000	[thread overview]
Message-ID: <20091216053151.31526.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins@sourceware.org	2009-12-16 05:31:51

Modified files:
	libmultipath   : pgpolicies.c 

Log message:
	Fix for 537977. The failover priority function now orders the paths by
	priority, so that multipath will correctly fail over.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/pgpolicies.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.7.2.1&r2=1.7.2.2

--- multipath-tools/libmultipath/pgpolicies.c	2009/04/03 15:09:02	1.7.2.1
+++ multipath-tools/libmultipath/pgpolicies.c	2009/12/16 05:31:50	1.7.2.2
@@ -206,7 +206,8 @@
 extern int
 one_path_per_group (struct multipath * mp)
 {
-	int i;
+	int i, j;
+	unsigned int prio;
 	struct path * pp;
 	struct pathgroup * pgp;
 
@@ -218,16 +219,30 @@
 
 	for (i = 0; i < VECTOR_SIZE(mp->paths); i++) {
 		pp = VECTOR_SLOT(mp->paths, i);
+		prio = pp->priority;
+
+		vector_foreach_slot(mp->pg, pgp, j) {
+			pp = VECTOR_SLOT(pgp->paths, 0);
+
+			if (prio > pp->priority)
+				break;
+		}
+
 		pgp = alloc_pathgroup();
 
 		if (!pgp)
 			goto out;
 
-		if (store_pathgroup(mp->pg, pgp))
-			goto out;
-		
-		if (store_path(pgp->paths, pp))
+		if (store_path(pgp->paths, VECTOR_SLOT(mp->paths, i)))
 			goto out;
+
+		if (j < VECTOR_SIZE(mp->pg)) {
+			if (!vector_insert_slot(mp->pg, j, pgp))
+				goto out;
+		} else {
+			if (store_pathgroup(mp->pg, pgp))
+				goto out;
+		}
 	}
 	free_pathvec(mp->paths, KEEP_PATHS);
 	mp->paths = NULL;

                 reply	other threads:[~2009-12-16  5:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20091216053151.31526.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.