Re: cd taste crash followup

From: Simon Heath <heath_at_cng.fr>
Date: Tue, 23 Dec 2003 12:26:45 +0100
On Tue, Dec 23, 2003 at 12:06:00PM +0100, Poul-Henning Kamp wrote:
> In message <20031223105208.GA8531_at_madiran.cng.fr>, Simon Heath writes:
> 
> >The calls come from g_orphan_register which calls g_dev_orphan() on each
> >element from pp->consumers, which in turn calls g_detach() which calls
> >g_destroy_provider().  g_orphan_register() then calls g_destroy_provider()
> >directly with pp (because G_PF_WITHER is set), but pp has already been
> >passed to g_destroy_provider() in the previous loop, so we end up with the
> >attempt to remove the devstat twice.  As to why pp appears as a provider in
> >pp->consumers I have no idea, but I hope this makes some sense to people who
> >understand GEOM.
> 
> Sigh, I know the per provider wither flag sounded too easy...
> 
> Can you try this patch ?
> 
> Index: geom_event.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/geom/geom_event.c,v
> retrieving revision 1.44
> diff -u -r1.44 geom_event.c
> --- geom_event.c	7 Dec 2003 10:04:43 -0000	1.44
> +++ geom_event.c	23 Dec 2003 11:04:58 -0000
> _at__at_ -126,10 +126,14 _at__at_
>  g_orphan_register(struct g_provider *pp)
>  {
>  	struct g_consumer *cp, *cp2;
> +	int wf;
>  
>  	g_trace(G_T_TOPOLOGY, "g_orphan_register(%s)", pp->name);
>  	g_topology_assert();
>  
> +	wf = pp->flags & G_PF_WITHER;
> +	pp->flags &= ~G_PF_WITHER;
> +
>  	/*
>  	 * Tell all consumers the bad news.
>  	 * Don't be surprised if they self-destruct.
> _at__at_ -143,8 +147,10 _at__at_
>  		cp->geom->orphan(cp);
>  		cp = cp2;
>  	}
> -	if (LIST_EMPTY(&pp->consumers) && (pp->flags & G_PF_WITHER))
> +	if (LIST_EMPTY(&pp->consumers) && wf)
>  		g_destroy_provider(pp);
> +	else
> +		pp->flags |= wf;
>  #ifdef notyet
>  	cp = LIST_FIRST(&pp->consumers);
>  	if (cp != NULL)
> 

That works fine for me - I can't reproduce the crash with this patch.

Thanks,
Simon
Received on Tue Dec 23 2003 - 02:26:48 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:35 UTC