[dm-devel] [PATCH] [RFC] multipath: multipath command pathgroup compare problem

Malahal Naineni malahal at us.ibm.com
Tue Nov 9 08:30:36 UTC 2010


I have 2 pathgroups to a LUN and each pathgroup has 2 paths. Say P1,P2
belong to PG1 and P3,P4 belong to PG2.

I deleted P2 from the system and added it back. I also stopped
multipathd on purpose. Now, running multipath command is not adding the
new path P3 back to the table.

After some debugging, I found that both the pathgroups in mpp->pg
compute their ids to be same and is 20020. The actual loaded table's
pathgroup ids are computed as 61E860 and 20020. The pgcmp() returns 0
here as the same pathgroup PG2 from the loaded table (cmpp) is compared
against PG1 and PG2 of intended table (mpp)

Added a found field to avoid using the same pathgroup multiple times.

The fact that the exclusive ORing computation of path address can
evaluate to the same value for two different pathgroups indicates that
we may a hit different problem in the future. The best way to do this is
sorting pathgroups and paths within the pathgroup and just compare path
by path. Any suggestions or am I missing something here?

Signed-off-by: Malahal Naineni (malahal at us.ibm.com)

diff -r 1dc078c2002f -r 53a3cae5dc7a libmultipath/configure.c
--- a/libmultipath/configure.c	Tue Nov 09 00:07:04 2010 -0800
+++ b/libmultipath/configure.c	Tue Nov 09 00:30:17 2010 -0800
@@ -125,11 +125,14 @@ pgcmp (struct multipath * mpp, struct mu
 	if (!mpp)
 		return 0;
 
+	vector_foreach_slot (cmpp->pg, cpgp, j) {
+		cpgp->found = 0;
+	}
 	vector_foreach_slot (mpp->pg, pgp, i) {
 		compute_pgid(pgp);
-
 		vector_foreach_slot (cmpp->pg, cpgp, j) {
-			if (pgp->id == cpgp->id) {
+			if (!cpgp->found && pgp->id == cpgp->id) {
+				cpgp->found = 1;
 				r = 0;
 				break;
 			}
diff -r 1dc078c2002f -r 53a3cae5dc7a libmultipath/structs.h
--- a/libmultipath/structs.h	Tue Nov 09 00:07:04 2010 -0800
+++ b/libmultipath/structs.h	Tue Nov 09 00:30:17 2010 -0800
@@ -210,6 +210,7 @@ struct multipath {
 
 struct pathgroup {
 	long id;
+	int found;
 	int status;
 	int priority;
 	int enabled_paths;




More information about the dm-devel mailing list