[openib-general] [PATCH] close /dev/infiniband/issm on opensm teardown

Tom Duffy tduffy at sun.com
Thu Jan 20 14:11:27 PST 2005


I have been getting this now for a bit (a few days) where I cannot kill
opensm without a kill -9.

This is caused by the fact that osm_vendor_ibumad.c's version of
osm_vendor_set_sm only knows how to open issm, not close it.  Here is a
patch that fixes this and allows opensm to exit gracefully.

I have included it inline as well as an attachment in case somebody's
Exchange server decides to munge my RFC-compliant quoted-printable
email.

Signed-off-by: Tom Duffy <tduffy at sun.com>

Index: osm/include/vendor/osm_vendor_ibumad.h
===================================================================
--- osm/include/vendor/osm_vendor_ibumad.h	(revision 1603)
+++ osm/include/vendor/osm_vendor_ibumad.h	(working copy)
@@ -203,6 +203,7 @@ typedef	struct _osm_vendor
 	umad_port_t umad_port;
 	int umad_port_id;
 	void *receiver;
+	int issmfd;
 } osm_vendor_t;
 
 #define OSM_BIND_INVALID_HANDLE 0
Index: osm/libvendor/osm_vendor_ibumad.c
===================================================================
--- osm/libvendor/osm_vendor_ibumad.c	(revision 1603)
+++ osm/libvendor/osm_vendor_ibumad.c	(working copy)
@@ -372,6 +372,7 @@ osm_vendor_init(
 	p_vend->max_retries = OSM_DEFAULT_RETRY_COUNT;
 
 	p_vend->umad_port_id = -1;
+	p_vend->issmfd = -1;
 
 	/*
 	 * Open our instance of UMAD.
@@ -839,14 +840,22 @@ osm_vendor_set_sm(
 	osm_umad_bind_info_t *p_bind = (osm_umad_bind_info_t *)h_bind;
 	osm_vendor_t *p_vend = p_bind->p_vend;
 	char issmstring[24];
-	int issmfd;
 
 	OSM_LOG_ENTER( p_vend->p_log, osm_vendor_set_sm );
 	sprintf(issmstring, "/dev/infiniband/issm%d", p_vend->umad_port_id);
-	issmfd = open(issmstring, 0);
-	if (issmfd < 0) {
-		osm_log(p_vend->p_log, OSM_LOG_ERROR,
-			"osm_vendor_set_sm: setting IS_SM capability mask failed; errno %d\n", errno);
+	if (TRUE == is_sm_val) {
+		p_vend->issmfd = open(issmstring, 0);
+		if (p_vend->issmfd < 0) {
+			osm_log(p_vend->p_log, OSM_LOG_ERROR,
+				"osm_vendor_set_sm: setting IS_SM capability"
+				" mask failed; errno %d\n", errno);
+		}
+	} else {
+		if (p_vend->issmfd != -1)
+			if (0 != close(p_vend->issmfd))
+				osm_log(p_vend->p_log, OSM_LOG_ERROR,
+				"osm_vendor_set_sm: clearing IS_SM failed\n");
+		p_vend->issmfd = -1;
 	}
 	OSM_LOG_EXIT( p_vend->p_log );
 }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: osm-issm.patch
Type: text/x-patch
Size: 1813 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050120/6fe2e7ce/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050120/6fe2e7ce/attachment.sig>


More information about the general mailing list