From e1a1d9d90ed7de45a07c605c1a33c3ebd4202b81 Mon Sep 17 00:00:00 2001 From: Gleb Natapov Date: Mon, 27 Aug 2007 11:41:42 +0000 Subject: [PATCH] Receive request converter can be accessed in parallel by a thread that receives data and a thread that run RDMA schedule function. Protect access to the converter by a lock. This commit was SVN r15967. --- ompi/mca/pml/ob1/pml_ob1_recvreq.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ompi/mca/pml/ob1/pml_ob1_recvreq.c b/ompi/mca/pml/ob1/pml_ob1_recvreq.c index ffc50473f9..cb8e370c28 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvreq.c @@ -642,9 +642,6 @@ int mca_pml_ob1_recv_request_schedule_exclusive( prev_bytes_remaining = bytes_remaining; } - ompi_convertor_set_position(&recvreq->req_recv.req_base.req_convertor, - &recvreq->req_rdma_offset); - do { rdma_idx = recvreq->req_rdma_idx; bml_btl = recvreq->req_rdma[rdma_idx].bml_btl; @@ -662,10 +659,19 @@ int mca_pml_ob1_recv_request_schedule_exclusive( size = bml_btl->btl_rdma_pipeline_frag_size; } + /* take lock to protect converter against concurrent access + * from unpack */ + OPAL_THREAD_LOCK(&recvreq->lock); + ompi_convertor_set_position( + &recvreq->req_recv.req_base.req_convertor, + &recvreq->req_rdma_offset); + /* prepare a descriptor for RDMA */ mca_bml_base_prepare_dst(bml_btl, reg, &recvreq->req_recv.req_base.req_convertor, MCA_BTL_NO_ORDER, 0, &size, &dst); + OPAL_THREAD_UNLOCK(&recvreq->lock); + if( OPAL_UNLIKELY(dst == NULL) ) { continue; }