Locking fixes to IPv6 scope6.c

Giorgos Keramidas keramida at freebsd.org
Sat Oct 16 05:23:59 PDT 2004


On 2004-10-16 18:22, gnn at FreeBSD.org wrote:
> Howdy,
>
> 	Here is a proposed set of diffs for locking fixes in the
> 	scope6.c module.  Please let me know anyone has questions or
> 	comments.
>
> Thanks,
> George

I'm not a networking expert, but there are some style bugs you might
want to have fixed before committing this:

> Index: scope6.c
> ===================================================================
> RCS file: /Volumes/exported/FreeBSD-CVS/src/sys/netinet6/scope6.c,v
> retrieving revision 1.10
> diff -u -r1.10 scope6.c
> --- scope6.c	22 Oct 2003 15:13:36 -0000	1.10
> +++ scope6.c	16 Oct 2004 09:19:53 -0000
> @@ -1,4 +1,4 @@
> -/*	$FreeBSD$	*/
> +/*	$FreeBSD: src/sys/netinet6/scope6.c,v 1.10 2003/10/22 15:13:36 ume Exp $	*/
>  /*	$KAME: scope6.c,v 1.10 2000/07/24 13:29:31 itojun Exp $	*/
>
>  /*
> @@ -71,12 +71,14 @@
>  scope6_ifattach(ifp)
>  	struct ifnet *ifp;
>  {
> -	int s = splnet();
> +
>  	struct scope6_id *sid;

The empty line at the beginning of the function body can go away, since
there *is* at least one local variable present.

> +	/*
> +	 * SID retrieves data from the afdata section of the ifnet
> +	 * structure, but wwe also depend on ifp staying around for a
> +	 * while so lock the list, instead of the smaller afdata lock
> +	 * for the as long as we need either of them.
> +	 */

s/wwe/we/
s/for the as long as/for as long as/

> +	/*
> +	 * Need both the ifp and its afdata to stick around for
> +	 * this call.
> +	 */
> +	IFNET_WLOCK();

Make this a real sentence, please: ``We need both...''.

Regards,
Giorgos



More information about the freebsd-net mailing list