diff mbox

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

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

Commit Message

Chauhan, Vijay Nov. 23, 2009, 5:51 a.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-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))