From 5d0b4679eaec0f3432fa12123dc03e38d545efc9 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 6 Jun 2016 17:54:55 -0600 Subject: [PATCH] pml/ob1: bug fixes This commit fixes two bugs in pml/ob1: - Do not called MCA_PML_OB1_PROGRESS_PENDING from mca_pml_ob1_send_request_start_copy as this may lead to a recursive call to mca_pml_ob1_send_request_process_pending. - In mca_pml_ob1_send_request_start_rdma return the rdma frag object if a btl fragment can not be allocated. This fixes a leak identified by @abouteiller and @bosilca. Signed-off-by: Nathan Hjelm --- ompi/mca/pml/ob1/pml_ob1_sendreq.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ompi/mca/pml/ob1/pml_ob1_sendreq.c b/ompi/mca/pml/ob1/pml_ob1_sendreq.c index 54b7d8ebca..57ff6fd3dc 100644 --- a/ompi/mca/pml/ob1/pml_ob1_sendreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_sendreq.c @@ -13,7 +13,7 @@ * Copyright (c) 2008 UT-Battelle, LLC. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights + * Copyright (c) 2012-2016 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ @@ -495,9 +495,6 @@ int mca_pml_ob1_send_request_start_copy( mca_pml_ob1_send_request_t* sendreq, if( OPAL_LIKELY(OMPI_SUCCESS == rc) ) { /* signal request completion */ send_request_pml_complete(sendreq); - - /* check for pending requests */ - MCA_PML_OB1_PROGRESS_PENDING(bml_btl); return OMPI_SUCCESS; } @@ -688,9 +685,6 @@ int mca_pml_ob1_send_request_start_rdma( mca_pml_ob1_send_request_t* sendreq, frag->cbfunc = mca_pml_ob1_rget_completion; /* do not store the local handle in the fragment. it will be released by mca_pml_ob1_free_rdma_resources */ - /* save the fragment for get->put fallback */ - sendreq->rdma_frag = frag; - reg_size = bml_btl->btl->btl_registration_handle_size; /* allocate space for get hdr + segment list */ @@ -699,9 +693,13 @@ int mca_pml_ob1_send_request_start_rdma( mca_pml_ob1_send_request_t* sendreq, MCA_BTL_DES_FLAGS_SIGNAL); if( OPAL_UNLIKELY(NULL == des) ) { /* NTH: no need to reset the converter here. it will be reset before it is retried */ + MCA_PML_OB1_RDMA_FRAG_RETURN(frag); return OMPI_ERR_OUT_OF_RESOURCE; } + /* save the fragment for get->put fallback */ + sendreq->rdma_frag = frag; + /* build match header */ hdr = (mca_pml_ob1_rget_hdr_t *) des->des_segments->seg_addr.pval; /* TODO -- Add support for multiple segments for get */