[dm-devel] [PATCH] multipath-tools: multipath should allow only path with valid size to get added in the map

Chauhan, Vijay Vijay.Chauhan at lsi.com
Mon Nov 23 05:51:58 UTC 2009


 
On Friday, November 20, 2009 at 21:55:00 UTC, Chandra Seetharaman wrote :
 > Looks good to me except one comment below.
 > 

 > > +			if ((!pp->size) || (mpp->size != pp->size)) {
 > > +				condlog(0, "%s: failed to add 
 > new path %s, "
 > > +					"device size mismatch",
 > 
 > Appropriate error message for the two different cases 
 > (pp->size = 0 and
 > mpp->size!= pp->size) would be the right thing to do, IMO.
 > 
 > > +					devname, pp->dev);

Chandra, Thanks for you comment. I have made the changes as per your comment.

Please let me if it looks fine now.


Thanks,
Vijay


---
multipath should only add paths with valid size to the map. If there is mismatch between map and path size it should not be added. This patch also check if the device size is not 0 before adding path. During device discovery if READ_CAPACITY fails, sd device get attached with device size 0. multipath should not allow the such device to get added in the map.

Signed-off-by: Vijay Chauhan <vijay.chauhan at lsi.com>
---
diff -uprN multipath-tools-orig/multipathd/main.c multipath-tools/multipathd/main.c
--- multipath-tools-orig/multipathd/main.c	2009-11-20 23:39:09.000000000 +0530
+++ multipath-tools/multipathd/main.c	2009-11-23 16:37:16.000000000 +0530
@@ -396,8 +396,29 @@ ev_add_path (char * devname, struct vect
 		return 2;
 	}
 	mpp = pp->mpp = find_mp_by_wwid(vecs->mpvec, pp->wwid);
+	if (!pp->size) {
+		condlog(0, "%s: not a valid path %s, "
+			" device size is 0 ", devname, pp->dev);
+		int i = find_slot(vecs->pathvec, (void *)pp);
+		if (i != -1)
+			vector_del_slot(vecs->pathvec, i);
+		free_path(pp);
+		return 1;
+	}
+
 rescan:
 	if (mpp) {
+		if (mpp->size != pp->size) {
+			condlog(0, "%s: failed to add new path %s, "
+				"device size mismatch",
+				devname, pp->dev);
+			int i = find_slot(vecs->pathvec, (void *)pp);
+			if (i != -1)
+				vector_del_slot(vecs->pathvec, i);
+			free_path(pp);
+			return 1;
+		}
+
 		condlog(4,"%s: adopting all paths for path %s",
 			mpp->alias, pp->dev);
 		if (adopt_paths(vecs->pathvec, mpp))
--




More information about the dm-devel mailing list