[ofa-general] Opensm dies with updn specified in opensm.opts

Sasha Khapyorsky sashak at voltaire.com
Wed Apr 4 10:51:50 PDT 2007


On 12:08 Mon 02 Apr     , Steven Carter wrote:
> 
> OpenSM (from OFED 1.1) runs when '-R updn' is specified on the command 
> line for up/down routing, but seg faults when it is specified in 
> opensm.opts.
> 
> # Start with clean opensm.opts:
> 
> [root at bruiser osm]# rm /var/cache/osm/opensm.opts
> rm: remove regular file `/var/cache/osm/opensm.opts'? y
> [root at bruiser osm]# /opt/ofed-1.1/bin/opensm -c
> -------------------------------------------------
> OpenSM Rev:openib-2.0.5
> Based on OpenIB svn Exported revision
> Command Line Arguments:
> Caching command line options
> Log File: /var/log/osm.log
> -------------------------------------------------
> OpenSM Rev:openib-2.0.5 OpenIB svn Exported revision
> 
> Using default GUID 0x8f1040397886d
> Entering MASTER state
> 
> SUBNET UP
> 
> OpenSM: Got signal 2 - exiting...
> Exiting SM
> 
> # Runs fine with clean opensm.opts:
> 
> [root at bruiser osm]# /opt/ofed-1.1/bin/opensm
> -------------------------------------------------
> OpenSM Rev:openib-2.0.5
> Based on OpenIB svn Exported revision
> Using Cached Option:guid = 0x0008f1040397886d
> Using Cached Option:log_flags = 3
> Command Line Arguments:
> Log File: /var/log/osm.log
> -------------------------------------------------
> OpenSM Rev:openib-2.0.5 OpenIB svn Exported revision
> 
> Entering MASTER state
> 
> SUBNET UP
> 
> OpenSM: Got signal 2 - exiting...
> Exiting SM
> 
> # Specify up/down routing and write out to opensm.opts:
> 
> [root at bruiser osm]# /opt/ofed-1.1/bin/opensm -R updn -c
> -------------------------------------------------
> OpenSM Rev:openib-2.0.5
> Based on OpenIB svn Exported revision
> Using Cached Option:guid = 0x0008f1040397886d
> Using Cached Option:log_flags = 3
> Command Line Arguments:
> Activate 'updn' routing engine
> Caching command line options
> Log File: /var/log/osm.log
> -------------------------------------------------
> OpenSM Rev:openib-2.0.5 OpenIB svn Exported revision
> 
> Entering MASTER state
> 
> SUBNET UP
> 
> OpenSM: Got signal 2 - exiting...
> Exiting SM
> 
> # And it dies:
> 
> [root at bruiser osm]# /opt/ofed-1.1/bin/opensm
> -------------------------------------------------
> OpenSM Rev:openib-2.0.5
> Based on OpenIB svn Exported revision
> Using Cached Option:guid = 0x0008f1040397886d
> Segmentation fault 
> 
> # The routing is the only difference:
> 
> [root at bruiser osm]# diff opensm.opts.updn opensm.opts.good
> 103,105d102
> < # Routing engine
> < routing_engine updn
> <

I think it was fixed after ofed 1.1 by:


commit 1548f118654633c729a695c72133a493d6cd347d
Author: Ira Weiny <weiny2 at llnl.gov>
Date:   Wed Oct 25 22:03:14 2006 +0000

    r9963: opensm: fix for parsing subnet options which doesn't have default values
    
    From: Ira Weiny <weiny2 at llnl.gov>
    
    Here is a patch which seems to fix the issue for me. The routing
    algorithm pointer is not set at this point. I suppose if the "-R updn"
    had been in the command line sooner it might have worked but this is a
    better solution.
    
    Ira
    
    Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>

diff --git a/osm/opensm/osm_subnet.c b/osm/opensm/osm_subnet.c
index 2b25fc7..5f47c4d 100644
--- a/osm/opensm/osm_subnet.c
+++ b/osm/opensm/osm_subnet.c
@@ -648,13 +648,16 @@ __osm_subn_opts_unpack_charp(
 {
   if (!strcmp(p_req_key, p_key) && p_val_str)
   {
-    if (strcmp(p_val_str, *p_val))
+    if ((*p_val == NULL) || strcmp(p_val_str, *p_val))
     {
       char buff[128];
       sprintf(buff, " Using Cached Option:%s = %s\n",
               p_key, p_val_str);
       printf(buff);
       cl_log_event("OpenSM", LOG_INFO, buff, NULL, 0);
+      /* ignore the possible memory leak here,
+       * the pointer may be to a static default.
+       */
       *p_val = (char *)malloc( strlen(p_val_str) +1 );
       strcpy( *p_val, p_val_str);
     }


Sasha



More information about the general mailing list