[ofa-general] [PATCH 1/1] [v2.0] dapl extension: dapli_post_ext should always allocate cookie for requests.

Arlin Davis arlin.r.davis at intel.com
Mon Jun 2 14:14:40 PDT 2008


Request extensions didn't allocate cookie if completion was suppressed which resulted
segfault during provider post call. Provider's expect cookie for wr_id,
even with surpressed completions, to handle events during errors.

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

diff --git a/dapl/openib_cma/dapl_ib_extensions.c b/dapl/openib_cma/dapl_ib_extensions.c
index 52b238f..1402057 100755
--- a/dapl/openib_cma/dapl_ib_extensions.c
+++ b/dapl/openib_cma/dapl_ib_extensions.c
@@ -173,7 +173,7 @@ dapli_post_ext( IN       DAT_EP_HANDLE		ep_handle,
 {
 	DAPL_EP 	*ep_ptr;
 	ib_qp_handle_t	qp_ptr;
-	DAPL_COOKIE	*cookie;
+	DAPL_COOKIE	*cookie = NULL;
 	DAT_RETURN	dat_status = DAT_SUCCESS;
 
 	dapl_dbg_log(DAPL_DBG_TYPE_API,
@@ -191,25 +191,19 @@ dapli_post_ext( IN       DAT_EP_HANDLE		ep_handle,
 	/*
 	 * Synchronization ok since this buffer is only used for send
 	 * requests, which aren't allowed to race with each other.
-	 * only if completion is expected
 	 */
-	if (!(DAT_COMPLETION_SUPPRESS_FLAG & flags)) {
-
-		dat_status = dapls_dto_cookie_alloc(
-						&ep_ptr->req_buffer,
-						DAPL_DTO_TYPE_EXTENSION,
-						user_cookie,
-						&cookie );
-
-		if ( dat_status != DAT_SUCCESS )
-			goto bail;
+	dat_status = dapls_dto_cookie_alloc(&ep_ptr->req_buffer,
+					    DAPL_DTO_TYPE_EXTENSION,
+					    user_cookie,
+					    &cookie);
+	if (dat_status != DAT_SUCCESS)
+		goto bail;
 		
-		/*
-		 * Take reference before posting to avoid race conditions with
-		 * completions
-		 */
-		dapl_os_atomic_inc(&ep_ptr->req_count);
-	}
+	/*
+	 * Take reference before posting to avoid race conditions with
+	 * completions
+	 */
+	dapl_os_atomic_inc(&ep_ptr->req_count);
 
 	/*
 	 * Invoke provider specific routine to post DTO
@@ -226,10 +220,8 @@ dapli_post_ext( IN       DAT_EP_HANDLE		ep_handle,
 					    flags);
 
 	if (dat_status != DAT_SUCCESS) {
-		if ( cookie != NULL ) {
-			dapl_os_atomic_dec(&ep_ptr->req_count);
-			dapls_cookie_dealloc(&ep_ptr->req_buffer, cookie);
-		}
+		dapl_os_atomic_dec(&ep_ptr->req_count);
+		dapls_cookie_dealloc(&ep_ptr->req_buffer, cookie);
 	}
 
 bail:
-- 
1.5.2.5






More information about the general mailing list