[ofa-general] [PATCH 1/1][v1.2] dapl: evd_alloc doesn't check for ib_wait_object_create errors.

Davis, Arlin R arlin.r.davis at intel.com
Tue Apr 22 14:28:03 PDT 2008


Fix error check in dapls_ib_wait_object_create() and dat_evd_alloc.
When attempting to create large number of evd's that exceed
open files limit the error was not propagated up causing
a segfault. Note: there are 3 FD's required for each EVD
2 for pipe, and one for ibv_comp_channel.

Change the error reporting to indicate correct return
code and log with non-debug builds.

Signed-off by: Arlin Davis ardavis at ichips.intel.com
---
 dapl/common/dapl_evd_util.c    |    5 +++++
 dapl/openib_cma/dapl_ib_cq.c   |    4 ++--
 dapl/openib_cma/dapl_ib_util.h |    4 +---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/dapl/common/dapl_evd_util.c b/dapl/common/dapl_evd_util.c
index 39a8dd9..36b776c 100644
--- a/dapl/common/dapl_evd_util.c
+++ b/dapl/common/dapl_evd_util.c
@@ -243,6 +243,11 @@ dapls_evd_alloc (
 	    ((evd_flags & ~ (DAT_EVD_DTO_FLAG|DAT_EVD_RMR_BIND_FLAG)) ==
0 ))
     {
         dapls_ib_wait_object_create (evd_ptr,
&evd_ptr->cq_wait_obj_handle);
+	if (evd_ptr->cq_wait_obj_handle == NULL) {
+		dapl_os_free(evd_ptr, sizeof (DAPL_EVD));
+		evd_ptr = NULL;
+		goto bail;
+	}
     }
 #endif
 
diff --git a/dapl/openib_cma/dapl_ib_cq.c b/dapl/openib_cma/dapl_ib_cq.c
index ab4eafc..25b4551 100644
--- a/dapl/openib_cma/dapl_ib_cq.c
+++ b/dapl/openib_cma/dapl_ib_cq.c
@@ -250,7 +250,7 @@ dapls_ib_cq_alloc(IN DAPL_IA *ia_ptr,
 					      channel, 0);
 	
 	if (evd_ptr->ib_cq_handle == IB_INVALID_HANDLE) 
-		return	DAT_INSUFFICIENT_RESOURCES;
+		return(dapl_convert_errno(errno,"create_cq"));
 
 	/* arm cq for events */
 	dapls_set_cq_notify(ia_ptr, evd_ptr);
@@ -469,7 +469,7 @@ dapls_ib_wait_object_create(IN DAPL_EVD *evd_ptr,
 bail:
 	dapl_os_free(*p_cq_wait_obj_handle, 
 		     sizeof(struct _ib_wait_obj_handle));
-
+	*p_cq_wait_obj_handle = NULL;
 	return(dapl_convert_errno(errno," wait_object_create"));
 }
 
diff --git a/dapl/openib_cma/dapl_ib_util.h
b/dapl/openib_cma/dapl_ib_util.h
index 457d26b..93f4fde 100755
--- a/dapl/openib_cma/dapl_ib_util.h
+++ b/dapl/openib_cma/dapl_ib_util.h
@@ -314,11 +314,9 @@ dapl_convert_errno( IN int err, IN const char *str
)
 {
     if (!err)	return DAT_SUCCESS;
     	
-#if DAPL_DBG
     if ((err != EAGAIN) && (err != ETIME) && 
 	(err != ETIMEDOUT) && (err != EINTR))
-	dapl_dbg_log (DAPL_DBG_TYPE_ERR," %s %s\n", str, strerror(err));
-#endif 
+	dapl_log (DAPL_DBG_TYPE_ERR," %s %s\n", str, strerror(err));
 
     switch( err )
     {
-- 
1.5.2.5




More information about the general mailing list