[Pvfs2-developers] Re: look over this create change

Sam Lang slang at mcs.anl.gov
Wed Jul 25 01:20:06 EDT 2007


Hi Pete,

Sorry for the delayed response.  Yep that looks like a big leak.

-sam

On Jul 24, 2007, at 12:44 PM, Pete Wyckoff wrote:

> Hey Sam.  I checked some things in and was hoping to get you to look
> at it.  Maybe you already looked at this mess.
>
> There are two diffs, because I was confused about the need to
> preallocate two of the arrays before the create call.  Saw that
> num_data_files could change and made the wrong assumption.  So just
> look at the diff from 107 to 109 below.
>
> When you did the layout checkin, you moved the allocation of
> msgarray down to after the map_servers() call, presumably because
> that can modify num_data_files.  But you left in the first
> allocation where it was originally, so I whacked that.
>
> Let me know if I'm still misunderstanding something.
>
> 		-- Pete
>
>
> Index: src/client/sysint/sys-create.sm
> ===================================================================
> RCS file: /projects/cvsroot/pvfs2/src/client/sysint/sys-create.sm,v
> retrieving revision 1.107
> retrieving revision 1.109
> diff -u -p -r1.107 -r1.109
> --- src/client/sysint/sys-create.sm	6 Jul 2007 05:23:20 -0000	1.107
> +++ src/client/sysint/sys-create.sm	24 Jul 2007 17:41:04 -0000	1.109
> @@ -625,24 +625,6 @@ static PINT_sm_action create_datafiles_s
>
>      js_p->error_code = 0;
>
> -    memset(&sm_p->msgpair, 0, sizeof(PINT_sm_msgpair_state));
> -
> -    /* allocate msgarray and set msgarray_count */
> -    if (sm_p->msgarray && (sm_p->msgarray != &(sm_p->msgpair)))
> -    {
> -        free(sm_p->msgarray);
> -    }
> -    sm_p->msgarray = (PINT_sm_msgpair_state *)malloc(
> -        (sm_p->u.create.num_data_files *
> -         sizeof(PINT_sm_msgpair_state)));
> -    if (sm_p->msgarray == NULL)
> -    {
> -        gossip_err("create: failed to allocate msgarray\n");
> -        js_p->error_code = -PVFS_ENOMEM;
> -        return SM_ACTION_COMPLETE;
> -    }
> -    sm_p->msgarray_count = sm_p->u.create.num_data_files;
> -
>      /* allocate handle extent array objects */
>      if (sm_p->u.create.io_handle_extent_array == NULL)
>      {
> @@ -709,7 +691,7 @@ static PINT_sm_action create_datafiles_s
>      {
>          gossip_err("create: failed to allocate msgarray\n");
>          js_p->error_code = -PVFS_ENOMEM;
> -        return 1;
> +        return SM_ACTION_COMPLETE;
>      }
>      sm_p->msgarray_count = sm_p->u.create.num_data_files;
>
>



More information about the Pvfs2-developers mailing list