[ofa-general] [PATCH 2/2][dat1.2] dapl: Fix long delays with the cma provider open call when DNS is not configure on server.

Davis, Arlin R arlin.r.davis at intel.com
Mon May 12 11:29:40 PDT 2008


Open call should default to netdev names when resolving local IP address
for cma binding to match dat.conf settings. The open code attempts to
resolve with IP or Hostname first and if there is no DNS services setup
the failover to netdev name resolution is delayed for as much as 20
seconds.

Signed-off by: Arlin Davis ardavis at ichips.intel.com
---
 dapl/openib_cma/dapl_ib_util.c |   36
++++++++++++++++--------------------
 1 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/dapl/openib_cma/dapl_ib_util.c
b/dapl/openib_cma/dapl_ib_util.c
index 4de5a2c..e76e319 100755
--- a/dapl/openib_cma/dapl_ib_util.c
+++ b/dapl/openib_cma/dapl_ib_util.c
@@ -117,28 +117,24 @@ bail:
 static int getipaddr(char *name, char *addr, int len)
 {
 	struct addrinfo *res;
-	int ret;
 	
-	/* Assume network name and address type for first attempt */
-	if (getaddrinfo(name, NULL, NULL, &res)) {
-		/* retry using network device name */
-		ret = getipaddr_netdev(name,addr,len);
-		if (ret) {
+	/* assume netdev for first attempt, then network and address
type */
+	if (getipaddr_netdev(name,addr,len)) {
+		if (getaddrinfo(name, NULL, NULL, &res)) {
 			dapl_log(DAPL_DBG_TYPE_ERR,
-				 " open_hca: getaddr_netdev ERROR:"
-				 " %s. Is %s configured?\n",
-				 strerror(errno), name);
-			return ret;
-		}
-	} else {
-		if (len >= res->ai_addrlen)
-			memcpy(addr, res->ai_addr, res->ai_addrlen);
-		else {
+		 		" open_hca: getaddr_netdev ERROR:"
+		 		" %s. Is %s configured?\n",
+		 		strerror(errno), name);
+			return 1;
+		} else {
+			if (len >= res->ai_addrlen) 
+				memcpy(addr, res->ai_addr,
res->ai_addrlen);
+			else {
+				freeaddrinfo(res);
+				return 1;
+			}
 			freeaddrinfo(res);
-			return EINVAL;
 		}
-		
-		freeaddrinfo(res);
 	}
 
 	dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
@@ -642,7 +638,7 @@ DAT_RETURN dapli_ib_thread_init(void)
 	while (g_ib_thread_state != IB_THREAD_RUN) {
                 struct timespec sleep, remain;
                 sleep.tv_sec = 0;
-                sleep.tv_nsec = 20000000; /* 20 ms */
+                sleep.tv_nsec = 2000000; /* 2 ms */
                 dapl_dbg_log(DAPL_DBG_TYPE_UTIL,
                              " ib_thread_init: waiting for
ib_thread\n");
 		dapl_os_unlock(&g_hca_lock);
@@ -679,7 +675,7 @@ void dapli_ib_thread_destroy(void)
 	while ((g_ib_thread_state != IB_THREAD_EXIT) && (retries--)) {
 		struct timespec	sleep, remain;
 		sleep.tv_sec = 0;
-		sleep.tv_nsec = 20000000; /* 20 ms */
+		sleep.tv_nsec = 2000000; /* 2 ms */
 		dapl_dbg_log(DAPL_DBG_TYPE_UTIL, 
 			" ib_thread_destroy: waiting for ib_thread\n");
 		write(g_ib_pipe[1], "w", sizeof "w");
-- 
1.5.2.5




More information about the general mailing list