]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[IBAL] Fix race in UAL between CQ callbacks and CQ destruction.
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 15 May 2006 20:28:53 +0000 (20:28 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 15 May 2006 20:28:53 +0000 (20:28 +0000)
Submitted by: Leonid Keller (leonid@mellanox.co.il)

git-svn-id: svn://openib.tc.cornell.edu/gen1@349 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

trunk/core/al/al_common.c
trunk/core/al/al_common.h
trunk/core/al/user/ual_mgr.c

index ae93de100b308a1e963f374090b8fee70e424878..0430505612801b00f694b913e5432d16d575a105 100644 (file)
@@ -352,7 +352,7 @@ detach_al_obj(
  * Increment a reference count on an object.  This object should not be\r
  * an object's parent.\r
  */\r
-void\r
+int32_t\r
 ref_al_obj(\r
        IN                              al_obj_t * const                        p_obj )\r
 {\r
@@ -362,9 +362,10 @@ ref_al_obj(
        CL_TRACE( AL_DBG_AL_OBJ, g_al_dbg_lvl,\r
                ("%p(%s)\n", p_obj, ib_get_obj_type( p_obj ) ) );\r
        ref_cnt = cl_atomic_inc( &p_obj->ref_cnt );\r
-       CL_ASSERT( ref_cnt != 1 );\r
+       CL_ASSERT( ref_cnt != 1 || p_obj->type == AL_OBJ_TYPE_H_CQ );\r
 \r
        CL_EXIT( AL_DBG_AL_OBJ, g_al_dbg_lvl );\r
+       return ref_cnt;\r
 }\r
 \r
 \r
index 467dc371bc8c6d2ecdcd34aae3acf379ecc9ad68..1a0c22611f57657040fb0d31c7822fc889b55431 100644 (file)
@@ -286,7 +286,7 @@ attach_al_obj(
 /*\r
  * Increment the reference count on an AL object.\r
  */\r
-void\r
+int32_t\r
 ref_al_obj(\r
        IN                              al_obj_t * const                        p_obj );\r
 \r
index 48511ed51cba1ff8c96948928df2356cf186e10e..ee09bd691f0be9d578b9bd09452012646ad83b18 100644 (file)
@@ -693,11 +693,11 @@ __process_comp_cb(
        CL_ASSERT( p_comp_cb_info->cq_context );\r
        h_cq = (ib_cq_handle_t)(p_comp_cb_info->cq_context);\r
 \r
-       ref_al_obj( &h_cq->obj );\r
-\r
-       CL_ASSERT( h_cq->pfn_user_comp_cb );\r
-       h_cq->pfn_user_comp_cb( h_cq, (void*)h_cq->obj.context );\r
-\r
+       if( ref_al_obj( &h_cq->obj ) > 1 )\r
+       {\r
+               CL_ASSERT( h_cq->pfn_user_comp_cb );\r
+               h_cq->pfn_user_comp_cb( h_cq, (void*)h_cq->obj.context );\r
+       }\r
        deref_al_obj( &h_cq->obj );\r
 }\r
 \r