Skip to contentSkip to conversation

multipath devices are not created for the Luns having 8 paths

PATCH New Hannes Reinecke 1 participant 1 message Nov 9, 2006 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipath devices are not created for the Luns having 8 paths

When setting the rr_weight to 'priorities' multipath fails to setup a device-mapper table. This is due to a missing initialization of the minio field, which will be multiplied by the path priority for each path. This results in an eventual overflow of the minio field and an invalid device mapper table.

References: 203823

---

 libmultipath/dmparser.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

df3c39a22efd7e028aca40320ab2cbbd1c4b3bd5

libmultipath/dmparser.c +13 -6
index 2b170c6..c450882 100644
@@ -84,11 +84,14 @@ assemble_map (struct multipath * mp)
 		freechar -= shift;
 
 		vector_foreach_slot (pgp->paths, pp, j) {
-			if (mp->rr_weight == RR_WEIGHT_PRIO && pp->priority)
-				minio *= pp->priority;
+			int tmp_minio = minio;
+
+			if (mp->rr_weight == RR_WEIGHT_PRIO 
+			    && pp->priority > 0)
+				tmp_minio = minio * pp->priority;
 
 			shift = snprintf(p, freechar, " %s %d",
-					 pp->dev_t, minio);
+					 pp->dev_t, tmp_minio);
 			if (shift >= freechar) {
 				fprintf(stderr, "mp->params too small\n");
 				return 1;
@@ -117,6 +120,7 @@ disassemble_map (vector pathvec, char * 
 	int num_pg_args = 0;
 	int num_paths = 0;
 	int num_paths_args = 0;
+	int def_minio = 0;
 	struct path * pp;
 	struct pathgroup * pgp;
 
@@ -305,12 +309,15 @@ #endif
 				if (k == 0 && !strncmp(mpp->selector,
 						       "round-robin", 11)) {
 					p += get_word(p, &word);
-					mpp->minio = atoi(word);
+					def_minio = atoi(word);
 
-					if (mpp->rr_weight)
-						mpp->minio /= mpp->rr_weight;
+					if (mpp->rr_weight == RR_WEIGHT_PRIO 
+					    && pp->priority > 0)
+						def_minio /= pp->priority;
 
 					FREE(word);
+					if (def_minio != mpp->minio)
+						mpp->minio = def_minio;
 				}
 				else
 					p += get_word(p, NULL);
Signature · 4 lines
1.3.1


--------------010500070209030807080204--