1
1

usnic: properly destroy embedded small send frag

Without this, an `--enable-debug` build would hit an assertion in the
list code when run under valgrind with `--malloc-fill=0xff` or any other
case where malloc returned non-zeroed buffers.

Also allow the normal OBJ_ machinery to handle the constructor
invocation ordering for us instead of doing it by hand (which could have
led to future bugs).

Reviewed-by: jsquyres@cisco.com

cmr=v1.7.4

Depends on trunk functionality in r29095 and r29096.  Refs trac:3740,#3741.

This commit was SVN r29127.

The following SVN revision numbers were found above:
  r29095 --> open-mpi/ompi@d1b5940e97
  r29096 --> open-mpi/ompi@a552921171

The following Trac tickets were found above:
  Ticket 3740 --> https://svn.open-mpi.org/trac/ompi/ticket/3740
Этот коммит содержится в:
Dave Goodell 2013-09-04 20:59:12 +00:00
родитель 0d7fb932f1
Коммит 9cab9777d9
2 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -45,7 +45,7 @@ ompi_btl_usnic_force_retrans(
opal_hotel_checkout(&endpoint->endpoint_hotel, sseg->ss_hotel_room);
sseg->ss_hotel_room = -1;
/* Queue up this frag to be resent */
/* Queue up this segment to be resent */
opal_list_append(&(endpoint->endpoint_module->pending_resend_segs),
&(sseg->ss_base.us_list.super));

Просмотреть файл

@ -178,12 +178,11 @@ small_send_frag_constructor(ompi_btl_usnic_small_send_frag_t *frag)
{
ompi_btl_usnic_frag_segment_t *fseg;
send_frag_constructor(&frag->ssf_base);
/* construct the embedded segment */
fseg = &frag->ssf_segment;
/* us_list.ptr is "input" to the constructor, must come before ctor */
fseg->ss_base.us_list.ptr = frag->ssf_base.sf_base.uf_base.super.ptr;
frag_seg_constructor(fseg);
OBJ_CONSTRUCT(fseg, ompi_btl_usnic_frag_segment_t);
/* set us as parent in dedicated frag */
fseg->ss_parent_frag = (struct ompi_btl_usnic_send_frag_t *)frag;
@ -195,11 +194,20 @@ small_send_frag_constructor(ompi_btl_usnic_small_send_frag_t *frag)
fseg->ss_base.us_payload.raw;
}
static void
small_send_frag_destructor(ompi_btl_usnic_small_send_frag_t *frag)
{
ompi_btl_usnic_frag_segment_t *fseg;
fseg = &frag->ssf_segment;
assert(fseg->ss_parent_frag == (struct ompi_btl_usnic_send_frag_t *)frag);
assert(frag->ssf_base.sf_base.uf_type == OMPI_BTL_USNIC_FRAG_SMALL_SEND);
OBJ_DESTRUCT(fseg);
}
static void
large_send_frag_constructor(ompi_btl_usnic_large_send_frag_t *lfrag)
{
send_frag_constructor(&lfrag->lsf_base);
lfrag->lsf_base.sf_base.uf_type = OMPI_BTL_USNIC_FRAG_LARGE_SEND;
/* save data pointer for PML */
@ -252,7 +260,7 @@ OBJ_CLASS_INSTANCE(ompi_btl_usnic_frag_t,
OBJ_CLASS_INSTANCE(ompi_btl_usnic_send_frag_t,
ompi_btl_usnic_frag_t,
NULL,
send_frag_constructor,
NULL);
OBJ_CLASS_INSTANCE(ompi_btl_usnic_large_send_frag_t,
@ -263,7 +271,7 @@ OBJ_CLASS_INSTANCE(ompi_btl_usnic_large_send_frag_t,
OBJ_CLASS_INSTANCE(ompi_btl_usnic_small_send_frag_t,
ompi_btl_usnic_send_frag_t,
small_send_frag_constructor,
NULL);
small_send_frag_destructor);
OBJ_CLASS_INSTANCE(ompi_btl_usnic_put_dest_frag_t,
ompi_btl_usnic_frag_t,