[sheepdog] [PATCH RFC] sheep: free memory used for exceptional nodes

MORITA Kazutaka morita.kazutaka at gmail.com
Tue May 14 02:00:23 CEST 2013


At Tue, 14 May 2013 01:58:36 +0900,
MORITA Kazutaka wrote:
> 
> At Mon,  6 May 2013 23:46:04 +0900,
> Hitoshi Mitake wrote:
> > 
> > It seems that current clear_exceptional_node_lists() leaks memory used
> > for representing delayed and failed nodes.
> > 
> > Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> > ---
> >  sheep/group.c |    8 ++++++--
> >  1 files changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/sheep/group.c b/sheep/group.c
> > index bb5d703..d335807 100644
> > --- a/sheep/group.c
> > +++ b/sheep/group.c
> > @@ -452,10 +452,14 @@ static void clear_exceptional_node_lists(void)
> >  {
> >  	struct node *n, *t;
> >  
> > -	list_for_each_entry_safe(n, t, &sys->failed_nodes, list)
> > +	list_for_each_entry_safe(n, t, &sys->failed_nodes, list) {
> >  		list_del(&n->list);
> > -	list_for_each_entry_safe(n, t, &sys->delayed_nodes, list)
> > +		free(n);
> > +	}
> > +	list_for_each_entry_safe(n, t, &sys->delayed_nodes, list) {
> >  		list_del(&n->list);
> > +		free(n);
> > +	}
> 
> Freeing delayed nodes looks wrong because they will join sheepdog after they are
> removed from sys->delayed_nodes.

On the second thought, struct node is no longer used after sheepdog starts up,
so freeing them looks no problem.

Thanks,

Kazutaka



More information about the sheepdog mailing list