Return unused entry to free list before trying to allocate new one.
Otherwise the code may deadlock.
Index: ompi/mca/btl/openib/btl_openib_component.c
===================================================================
--- ompi/mca/btl/openib/btl_openib_component.c (revision 7878)
+++ ompi/mca/btl/openib/btl_openib_component.c (working copy)
@@ -590,6 +590,7 @@
&frag->base,
openib_btl->ib_reg[frag->hdr->tag].cbdata);
+ OMPI_FREE_LIST_RETURN(&(openib_btl->recv_free_eager),
(opal_list_item_t*) frag);
#ifdef OMPI_MCA_BTL_OPENIB_HAVE_SRQ
if(mca_btl_openib_component.use_srq) {
OPAL_THREAD_ADD32((int32_t*) &openib_btl->srr_posted_high,
-1);
@@ -601,7 +602,6 @@
#ifdef OMPI_MCA_BTL_OPENIB_HAVE_SRQ
}
#endif
- OMPI_FREE_LIST_RETURN(&(openib_btl->recv_free_eager),
(opal_list_item_t*) frag);
count++;
break;
@@ -683,6 +683,8 @@
&frag->base,
openib_btl->ib_reg[frag->hdr->tag].cbdata);
+ OMPI_FREE_LIST_RETURN(&(openib_btl->recv_free_max),
(opal_list_item_t*) frag);
+
#ifdef OMPI_MCA_BTL_OPENIB_HAVE_SRQ
if(mca_btl_openib_component.use_srq) {
OPAL_THREAD_ADD32((int32_t*) &openib_btl->srr_posted_low,
-1);
@@ -695,7 +697,6 @@
#ifdef OMPI_MCA_BTL_OPENIB_HAVE_SRQ
}
#endif
- OMPI_FREE_LIST_RETURN(&(openib_btl->recv_free_max),
(opal_list_item_t*) frag);
count++;
break;
--
Gleb.