[IBAL] bugfix: QP has to increment the reference on the pool key upon creation and...
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 15 Aug 2006 15:59:28 +0000 (15:59 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 15 Aug 2006 15:59:28 +0000 (15:59 +0000)
Submitted by: Fabian Tillier [ftillier@silverstorm.com]

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

core/al/al_qp.c

index bcd2f5a..9ff407c 100644 (file)
@@ -448,7 +448,14 @@ get_spl_qp(
                        status = ib_reg_mad_pool( gh_mad_pool, h_pd,\r
                                &((al_qp_alias_t*)h_qp)->pool_key );\r
                        if( status == IB_SUCCESS )\r
                        status = ib_reg_mad_pool( gh_mad_pool, h_pd,\r
                                &((al_qp_alias_t*)h_qp)->pool_key );\r
                        if( status == IB_SUCCESS )\r
+                       {\r
+                               /*\r
+                                * Take a reference on the pool key since we don't have a\r
+                                * mechanism for the pool key to clear the QP's pointer to it.\r
+                                */\r
+                               ref_al_obj( &((al_qp_alias_t*)h_qp)->pool_key->obj );\r
                                *p_pool_key = ((al_qp_alias_t*)h_qp)->pool_key;\r
                                *p_pool_key = ((al_qp_alias_t*)h_qp)->pool_key;\r
+                       }\r
                }\r
                break;\r
 \r
                }\r
                break;\r
 \r
@@ -1063,12 +1070,13 @@ destroying_qp(
                {\r
                        ib_api_status_t         status;\r
                        /* Deregister the pool_key. */\r
                {\r
                        ib_api_status_t         status;\r
                        /* Deregister the pool_key. */\r
-                       ref_al_obj( &p_qp_alias->pool_key->obj );\r
                        status = dereg_mad_pool( p_qp_alias->pool_key, AL_KEY_ALIAS );\r
                        if( status != IB_SUCCESS )\r
                        {\r
                        status = dereg_mad_pool( p_qp_alias->pool_key, AL_KEY_ALIAS );\r
                        if( status != IB_SUCCESS )\r
                        {\r
-                               AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("dereg_mad_pool returned %s.\n",\r
+                               AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,\r
+                                       ("dereg_mad_pool returned %s.\n",\r
                                        ib_get_err_str(status)) );\r
                                        ib_get_err_str(status)) );\r
+                               /* Release the reference taken when we created the pool key. */\r
                                deref_al_obj( &p_qp_alias->pool_key->obj );\r
                        }\r
                        p_qp_alias->pool_key = NULL;\r
                                deref_al_obj( &p_qp_alias->pool_key->obj );\r
                        }\r
                        p_qp_alias->pool_key = NULL;\r