diff mbox

[1/2] opensm/osm_torus.c: Add check for invalid topology discovery due to user misconfiguration.

Message ID 1284742994-24503-2-git-send-email-jaschut@sandia.gov (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Jim Schutt Sept. 17, 2010, 5:03 p.m. UTC
None
diff mbox

Patch

diff --git a/opensm/opensm/osm_torus.c b/opensm/opensm/osm_torus.c
index 0b7741d..12b480d 100644
--- a/opensm/opensm/osm_torus.c
+++ b/opensm/opensm/osm_torus.c
@@ -1623,6 +1623,22 @@  bool link_srcsink(struct torus *t, int i, int j, int k)
 		return true;
 
 	fsw = tsw->tmp;
+	/*
+	 * link_srcsink is supposed to get called once for every switch in
+	 * the fabric.  At this point every fsw we encounter must have a
+	 * non-null osm_switch.  Otherwise something has gone horribly
+	 * wrong with topology discovery; the most likely reason is that
+	 * the fabric contains a radix-4 torus dimension, but the user gave
+	 * a config that didn't say so, breaking all the checking in
+	 * safe_x_perpendicular and friends.
+	 */
+	if (!(fsw && fsw->osm_switch)) {
+		OSM_LOG(&t->osm->log, OSM_LOG_ERROR,
+			"Error: Invalid topology discovery. "
+			"Verify torus-2QoS.conf contents.\n");
+		return false;
+	}
+
 	pg = &tsw->ptgrp[2 * TORUS_MAX_DIM];
 	pg->type = SRCSINK;
 	tsw->osm_switch = fsw->osm_switch;