[Pvfs2-cvs] commit by pcarns in pvfs2-1/src/io/bmi/bmi_mx: mx.c

CVS commit program cvs at parl.clemson.edu
Thu May 22 10:21:42 EDT 2008


Update of /projects/cvsroot/pvfs2-1/src/io/bmi/bmi_mx
In directory parlweb1:/tmp/cvs-serv30695

Modified Files:
      Tag: small-file-branch
	mx.c 
Log Message:
Committing patch from Scott Atchley.  Updates mx address management in
server to server communication case.


Index: mx.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/io/bmi/bmi_mx/mx.c,v
diff -p -u -r1.11.2.1 -r1.11.2.2
--- mx.c	7 Apr 2008 15:07:24 -0000	1.11.2.1
+++ mx.c	22 May 2008 14:21:41 -0000	1.11.2.2
@@ -931,8 +931,9 @@ BMI_mx_initialize(bmi_method_addr_p list
                 uint32_t                ep_id   = 0;
                 uint32_t                sid     = 0;
                 uint64_t                nic_id  = 0ULL;
+                struct bmx_peer         *peer   = NULL;
 
-                bmi_mx->bmx_hostname = (char *) mxmap->mxm_hostname;
+                bmi_mx->bmx_hostname = strdup(mxmap->mxm_hostname);
                 bmi_mx->bmx_board = mxmap->mxm_board;
                 bmi_mx->bmx_ep_id = mxmap->mxm_ep_id;
                 bmi_mx->bmx_is_server = 1;
@@ -950,6 +951,8 @@ BMI_mx_initialize(bmi_method_addr_p list
                 mx_decompose_endpoint_addr2(epa, &nic_id, &ep_id, &sid);
                 bmi_mx->bmx_sid = sid;
 
+                bmx_peer_alloc(&peer, mxmap);
+
                 /* We allocate BMX_PEER_RX_NUM when we peer_alloc()
                  * Allocate some here to catch the peer CONN_REQ */
                 for (i = 0; i < BMX_SERVER_RXS; i++) {
@@ -1050,8 +1053,14 @@ BMI_mx_finalize(void)
         }
 #endif
 
-        if (bmi_mx->bmx_hostname) free(bmi_mx->bmx_hostname);
-        if (bmi_mx->bmx_peername) free(bmi_mx->bmx_peername);
+        if (bmi_mx->bmx_hostname) {
+                free(bmi_mx->bmx_hostname);
+                bmi_mx->bmx_hostname = NULL;
+        }
+        if (bmi_mx->bmx_peername) {
+                free(bmi_mx->bmx_peername);
+                bmi_mx->bmx_peername = NULL;
+        }
 
         bmi_mx = NULL;
 
@@ -2095,7 +2104,7 @@ bmx_alloc_method_addr(const char *peerna
         mxmap = map->method_data;
         mxmap->mxm_map = map;
         mxmap->mxm_peername = strdup(peername);
-        mxmap->mxm_hostname = hostname;
+        mxmap->mxm_hostname = strdup(hostname);
         mxmap->mxm_board = board;
         mxmap->mxm_ep_id = ep_id;
         /* mxmap->mxm_peer */
@@ -2291,6 +2300,7 @@ bmx_handle_conn_req(void)
                                         bmx_put_idle_rx(rx);
                                         continue;
                                 }
+                                free(host);
                                 mxmap = map->method_data;
                                 ret = bmx_peer_alloc(&peer, mxmap);
                                 if (ret != 0) {
@@ -2985,6 +2995,7 @@ BMI_mx_method_addr_lookup(const char *id
                                        " failed with %d", __func__, ret);
                         }
                 }
+                if (map != NULL) free(host);
         }
 out:
         debug(BMX_DB_FUNC, "leaving %s", __func__);



More information about the Pvfs2-cvs mailing list