[WSD] Fix a race that caused completing an overlapped send twice. (winib 2100)
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Fri, 21 Dec 2007 06:58:01 +0000 (06:58 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Fri, 21 Dec 2007 06:58:01 +0000 (06:58 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@924 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/wsd/user/ibsp_iblow.c
ulp/wsd/user/ibspstruct.h

index ff980ef..7c3af91 100644 (file)
@@ -396,6 +396,8 @@ ib_cq_comp(
                free_wclist = &wclist[0];\r
                done_wclist = NULL;\r
 \r
+               cl_spinlock_acquire(&cq_tinfo->cq_spinlock);\r
+\r
                status = ib_poll_cq( cq_tinfo->cq, &free_wclist, &done_wclist );\r
 \r
                IBSP_PRINT(TRACE_LEVEL_INFORMATION, IBSP_DBG_WQ,\r
@@ -413,6 +415,7 @@ ib_cq_comp(
                         * execution thread was calling lpWPUCompleteOverlappedRequest. */\r
                        IBSP_ERROR( (\r
                                "ib_poll_cq returned IB_INVLALID_CQ_HANDLE\n") );\r
+                       cl_spinlock_release(&cq_tinfo->cq_spinlock);\r
                        goto done;\r
 \r
                default:\r
@@ -436,6 +439,7 @@ ib_cq_comp(
 \r
                        done_wclist = done_wclist->p_next;\r
                }\r
+               cl_spinlock_release(&cq_tinfo->cq_spinlock);\r
 \r
                for( i = 0; i < cb_idx; i++ )\r
                {\r
@@ -661,6 +665,8 @@ ib_alloc_cq_tinfo(
        /* Upon allocation, the new CQ becomes the primary. */\r
        hca->cq_tinfo = cq_tinfo;\r
 \r
+       cl_spinlock_init(&cq_tinfo->cq_spinlock);\r
+\r
        IBSP_EXIT( IBSP_DBG_HW );\r
        return (cq_tinfo);\r
 }\r
@@ -682,6 +688,8 @@ ib_destroy_cq_tinfo(
        CL_ASSERT( cq_tinfo );\r
        CL_ASSERT( cq_tinfo->qp_count == 0 );\r
 \r
+       cl_spinlock_destroy(&cq_tinfo->cq_spinlock);\r
+\r
        if( cq_tinfo->cq )\r
        {\r
                wclist.p_next = NULL;\r
index 46fb0e5..14c5b85 100644 (file)
@@ -214,6 +214,7 @@ struct cq_thread_info
        HANDLE ib_cq_thread;\r
        DWORD   ib_cq_thread_id;\r
        BOOL ib_cq_thread_exit_wanted;\r
+       cl_spinlock_t cq_spinlock;\r
 \r
        struct ibsp_hca *hca;           /* HCA to which this cq belongs. */\r
 };\r