[PVFS2-CVS] commit by slang in pvfs2/src/io/bmi/bmi_ib: ib.c ib.h setup.c

CVS commit program cvs at parl.clemson.edu
Thu Jan 12 14:43:14 EST 2006


Update of /projects/cvsroot/pvfs2/src/io/bmi/bmi_ib
In directory parlweb:/tmp/cvs-serv3174/src/io/bmi/bmi_ib

Modified Files:
      Tag: dbpf-changes-branch
	ib.c ib.h setup.c 
Log Message:
merging changes from HEAD to dbpf branch


Index: ib.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/bmi/bmi_ib/ib.c,v
diff -p -u -r1.19 -r1.19.2.1
--- ib.c	11 Nov 2005 21:31:03 -0000	1.19
+++ ib.c	12 Jan 2006 19:43:13 -0000	1.19.2.1
@@ -5,7 +5,7 @@
  *
  * See COPYING in top-level directory.
  *
- * $Id: ib.c,v 1.19 2005/11/11 21:31:03 slang Exp $
+ * $Id: ib.c,v 1.19.2.1 2006/01/12 19:43:13 slang Exp $
  */
 #include <stdio.h>  /* just for NULL for id-generator.h */
 #include <src/common/id-generator/id-generator.h>
@@ -849,13 +849,15 @@ post_sr_rdmaw(ib_send_t *sq, msg_header_
 /*
  * Bring up the connection before posting a send or receive on it.
  */
-static void
+static int
 ensure_connected(struct method_addr *remote_map)
 {
+    int ret = 0;
     ib_method_addr_t *ibmap = remote_map->method_data;
 
     if (!ibmap->c)
-	ib_tcp_client_connect(ibmap, remote_map);
+	ret = ib_tcp_client_connect(ibmap, remote_map);
+    return ret;
 }
 
 /*
@@ -874,7 +876,9 @@ generic_post_send(bmi_op_id_t *id, struc
     int ret = 0;
 
     gen_mutex_lock(&interface_mutex);
-    ensure_connected(remote_map);
+    ret = ensure_connected(remote_map);
+    if (ret)
+    	goto out;
     ibmap = remote_map->method_data;
 
     /* alloc and build new sendq structure */
@@ -996,7 +1000,7 @@ BMI_ib_post_sendunexpected_list(bmi_op_i
 /*
  * Used by both recv and recv_list.
  */
-static void
+static int
 generic_post_recv(bmi_op_id_t *id, struct method_addr *remote_map,
   int numbufs, void *const *buffers, const bmi_size_t *sizes,
   bmi_size_t tot_expected_len, bmi_msg_tag_t tag,
@@ -1007,9 +1011,12 @@ generic_post_recv(bmi_op_id_t *id, struc
     ib_method_addr_t *ibmap;
     ib_connection_t *c;
     int i;
+    int ret = 0;
     
     gen_mutex_lock(&interface_mutex);
-    ensure_connected(remote_map);
+    ret = ensure_connected(remote_map);
+    if (ret)
+    	goto out;
     ibmap = remote_map->method_data;
     c = ibmap->c;
 
@@ -1091,7 +1098,7 @@ generic_post_recv(bmi_op_id_t *id, struc
 	goto out;
 
     } else if (rq->state == RQ_RTS_WAITING_USER_POST) {
-	int ret;
+	int sret;
 	debug(2, "%s: rq %p %s send cts", __func__, rq,
 	  rq_state_name(rq->state));
 	/* try to send, or wait for send buffer space */
@@ -1099,8 +1106,8 @@ generic_post_recv(bmi_op_id_t *id, struc
 #if MEMCACHE_EARLY_REG
 	memcache_register(&rq->buflist);
 #endif
-	ret = send_cts(rq);
-	if (ret == 0)
+	sret = send_cts(rq);
+	if (sret == 0)
 	    rq->state = RQ_RTS_WAITING_DATA;
 	goto out;
     }
@@ -1114,6 +1121,7 @@ generic_post_recv(bmi_op_id_t *id, struc
 
   out:
     gen_mutex_unlock(&interface_mutex);
+    return ret;
 }
 
 static int
@@ -1123,9 +1131,8 @@ BMI_ib_post_recv(bmi_op_id_t *id, struct
   bmi_context_id context_id)
 {
     debug(2, "%s: expected len %d tag %d", __func__, (int) expected_len, tag);
-    generic_post_recv(id, remote_map, 0, &buffer, &expected_len,
+    return generic_post_recv(id, remote_map, 0, &buffer, &expected_len,
       expected_len, tag, user_ptr, context_id);
-    return 0;
 }
 
 static int
@@ -1139,9 +1146,8 @@ BMI_ib_post_recv_list(bmi_op_id_t *id, s
       (int) tot_expected_len, tag);
     if (list_count < 1)
 	error("%s: list count must be positive", __func__);
-    generic_post_recv(id, remote_map, list_count, buffers, sizes,
+    return generic_post_recv(id, remote_map, list_count, buffers, sizes,
       tot_expected_len, tag, user_ptr, context_id);
-    return 0;
 }
 
 /*

Index: ib.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/bmi/bmi_ib/ib.h,v
diff -p -u -r1.9 -r1.9.6.1
--- ib.h	3 Nov 2005 21:23:19 -0000	1.9
+++ ib.h	12 Jan 2006 19:43:13 -0000	1.9.6.1
@@ -5,7 +5,7 @@
  *
  * See COPYING in top-level directory.
  *
- * $Id: ib.h,v 1.9 2005/11/03 21:23:19 pw Exp $
+ * $Id: ib.h,v 1.9.6.1 2006/01/12 19:43:13 slang Exp $
  */
 #ifndef __ib_h
 #define __ib_h
@@ -291,7 +291,7 @@ typedef struct {
  */
 extern void ib_close_connection(ib_connection_t *c);
 extern void close_connection_drain_qp(VAPI_qp_hndl_t qp);
-extern void ib_tcp_client_connect(ib_method_addr_t *ibmap,
+extern int ib_tcp_client_connect(ib_method_addr_t *ibmap,
   struct method_addr *remote_map);
 extern int ib_tcp_server_check_new_connections(void);
 extern int ib_tcp_server_block_new_connections(int timeout_ms);

Index: setup.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/io/bmi/bmi_ib/setup.c,v
diff -p -u -r1.18 -r1.18.2.1
--- setup.c	14 Dec 2005 21:50:20 -0000	1.18
+++ setup.c	12 Jan 2006 19:43:14 -0000	1.18.2.1
@@ -6,7 +6,7 @@
  *
  * See COPYING in top-level directory.
  *
- * $Id: setup.c,v 1.18 2005/12/14 21:50:20 slang Exp $
+ * $Id: setup.c,v 1.18.2.1 2006/01/12 19:43:14 slang Exp $
  */
 #include <fcntl.h>
 #include <unistd.h>
@@ -576,7 +576,7 @@ BMI_ib_method_addr_lookup(const char *id
  * Blocking connect initiated by a post_sendunexpected{,_list}, or
  * post_recv*
  */
-void
+int
 ib_tcp_client_connect(ib_method_addr_t *ibmap, struct method_addr *remote_map)
 {
     int s;
@@ -585,11 +585,15 @@ ib_tcp_client_connect(ib_method_addr_t *
     struct sockaddr_in skin;
     
     s = socket(AF_INET, SOCK_STREAM, 0);
-    if (s < 0)
-	error_errno("%s: create tcp socket", __func__);
+    if (s < 0) {
+	warning("%s: create tcp socket: %m", __func__);
+	return bmi_errno_to_pvfs(errno);
+    }
     hp = gethostbyname(ibmap->hostname);
-    if (!hp)
-	error_errno("%s: cannot resolve server %s", __func__, ibmap->hostname);
+    if (!hp) {
+	warning("%s: cannot resolve server %s", __func__, ibmap->hostname);
+	return -1;
+    }
     memset(&skin, 0, sizeof(skin));
     skin.sin_family = hp->h_addrtype;
     memcpy(&skin.sin_addr, hp->h_addr_list[0], (size_t) hp->h_length);
@@ -599,16 +603,21 @@ ib_tcp_client_connect(ib_method_addr_t *
     if (connect(s, (struct sockaddr *) &skin, sizeof(skin)) < 0) {
 	if (errno == EINTR)
 	    goto retry;
-	else
-	    error_errno("%s: connect to server %s", __func__, peername);
+	else {
+	    warning("%s: connect to server %s: %m", __func__, peername);
+	    return bmi_errno_to_pvfs(errno);
+	}
     }
     ibmap->c = ib_new_connection(s, peername, 0);
     if (!ibmap->c)
 	error("%s: ib_new_connection failed", __func__);
     ibmap->c->remote_map = remote_map;
 
-    if (close(s) < 0)
-	error_errno("%s: close sock", __func__);
+    if (close(s) < 0) {
+	warning("%s: close sock: %m", __func__);
+	return bmi_errno_to_pvfs(errno);
+    }
+    return 0;
 }
 
 /*



More information about the PVFS2-CVS mailing list