[ofa-general] [PATCH] opensm/lid_mgr: fix duplicated lid assignment

Sasha Khapyorsky sashak at voltaire.com
Wed Feb 25 09:53:00 PST 2009


When OpenSM is running with '-r' option (reassign lids) it will clean up
all internal free lid ranges and used_lids db, but not guid2lid db. Then
during new lids assignment for ports which don't presented in guid2lid
db LidMgr will ignore the fact that some port can already have the same
lid assigned. As result we will get a subnet with duplicated lids.

The proposed fix is to reassign all lids unconditionally (ignoring
existing guid2lid db and port's current lid value) if '-r' is specified.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_lid_mgr.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
index b74aba5..ec7fd86 100644
--- a/opensm/opensm/osm_lid_mgr.c
+++ b/opensm/opensm/osm_lid_mgr.c
@@ -773,6 +773,10 @@ __osm_lid_mgr_get_port_lid(IN osm_lid_mgr_t * const p_mgr,
 	    !osm_switch_sp0_is_lmc_capable(p_port->p_node->sw, p_mgr->p_subn))
 		num_lids = 1;
 
+	if (p_mgr->p_subn->first_time_master_sweep == TRUE &&
+	    p_mgr->p_subn->opt.reassign_lids == TRUE)
+		goto AssignLid;
+
 	/* if the port matches the guid2lid */
 	if (!osm_db_guid2lid_get(p_mgr->p_g2l, guid, &min_lid, &max_lid)) {
 		*p_min_lid = min_lid;
@@ -804,9 +808,7 @@ __osm_lid_mgr_get_port_lid(IN osm_lid_mgr_t * const p_mgr,
 
 	/* we want to ignore the discovered lid if we are also on first sweep of
 	   reassign lids flow */
-	if (min_lid &&
-	    !((p_mgr->p_subn->first_time_master_sweep == TRUE) &&
-	      (p_mgr->p_subn->opt.reassign_lids == TRUE))) {
+	if (min_lid) {
 		/* make sure lid is valid */
 		if ((num_lids == 1) || ((min_lid & lmc_mask) == min_lid)) {
 			/* is it free */
@@ -831,6 +833,7 @@ __osm_lid_mgr_get_port_lid(IN osm_lid_mgr_t * const p_mgr,
 				guid, min_lid, min_lid + num_lids - 1);
 	}
 
+AssignLid:
 	/* first cleanup the existing discovered lid range */
 	__osm_lid_mgr_cleanup_discovered_port_lid_range(p_mgr, p_port);
 
-- 
1.6.1.2.319.gbd9e




More information about the general mailing list