diff mbox

multipath-tools: multipath should allow only path with valid size to get added in the map

Message ID 0D1E8821739E724A86F4D16902CE275C1C93C74DFE@inbmail01.lsi.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chauhan, Vijay Nov. 20, 2009, 3:08 p.m. UTC
None
diff mbox

Patch

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-21 01:09:16.000000000 +0530
@@ -398,6 +398,17 @@  ev_add_path (char * devname, struct vect
 	mpp = pp->mpp = find_mp_by_wwid(vecs->mpvec, pp->wwid);
 rescan:
 	if (mpp) {
+			if ((!pp->size) || (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))
@@ -408,6 +419,16 @@  rescan:
 		mpp->action = ACT_RELOAD;
 	}
 	else {
+		if (!pp->size) {
+			condlog(0, "%s: failed to create new map,"
+				" %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;
+		}
+
 		condlog(4,"%s: creating new map", pp->dev);
 		if ((mpp = add_map_with_path(vecs, pp, 1)))
 			mpp->action = ACT_CREATE;