Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jun 2006 11:13:22 +0200
From:      Max Laier <max@love2party.net>
To:        Maxim Konovalov <maxim@macomnet.ru>
Cc:        cvs-src@freebsd.org, Gleb Smirnoff <glebius@freebsd.org>, src-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: src/sys/net if.c
Message-ID:  <200606211113.31621.max@love2party.net>
In-Reply-To: <20060621120212.D93005@mp2.macomnet.net>
References:  <200606210602.k5L62Zor029243@repoman.freebsd.org> <20060621120212.D93005@mp2.macomnet.net>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart2667997.84cDmJOyTc
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Wednesday 21 June 2006 10:06, Maxim Konovalov wrote:
> On Wed, 21 Jun 2006, 06:02-0000, Gleb Smirnoff wrote:
> > glebius     2006-06-21 06:02:35 UTC
> >
> >   FreeBSD src repository
> >
> >   Modified files:
> >     sys/net              if.c
> >   Log:
> >   - First initialize ifnet, and then insert it into global
> >     list.
> >   - First remove from global list, then start destroying.
> >
> >   PR:             kern/97679
> >   Submitted by:   Alex Lyashkov <shadow itt.net.ru>
> >   Reviewed by:    rwatson, brooks
>
> FWIW, even with Yar's recent commit to if_vlan.c it still panics.  I
> told Alex about that.  A testcase below.  Run it for several minutes.
>
> #11 0xc05e1a4a in calltrap () at /usr/src/sys/i386/i386/exception.s:138
> #12 0xc05608cb in in6ifa_ifpwithaddr (ifp=3D0xdeadc0de, addr=3D0xc39b5218)
> at /usr/src/sys/netinet6/in6.c:1862
> #13 0xc055e81d in in6_control (so=3D0xc2bbda60, cmd=3D0xc1206949,
> data=3D0xc39b5200 "vlan2349", ifp=3D0xc3973000,
>     td=3D0xc39b5210) at /usr/src/sys/netinet6/in6.c:459
> #14 0xc052c43c in ifioctl (so=3D0xc2bbda60, cmd=3D0xc1206949,
> data=3D0xc39b5200 "vlan2349", td=3D0xc2afd870)
>     at /usr/src/sys/net/if.c:1530
> #15 0xc04efb47 in soo_ioctl (fp=3D0xdeadc0de, cmd=3D0xc1206949,
> data=3D0xc39b5200, active_cred=3D0xc2e64700, td=3D0xc2afd870)
>     at /usr/src/sys/kern/sys_socket.c:214
> #16 0xc04ea810 in ioctl (td=3D0xc2afd870, uap=3D0xd56a7d04) at file.h:265

Yes, we simply keep too many implicit references to ifnets.  The real seque=
nce=20
for interface destruction should be:

=46irst mark unusable, wait long enough[*], remove from global list***s***,=
 wait=20
long enough[*], free.

Note that there is more than one global list an ifnet takes part in.  There=
 is=20
the index2ifp table, there are address lists in inet[6] etc. etc. ... I tri=
ed=20
to tackle this once and figured it was a minefield.  It is one of the=20
problematic cases where we have *way* more reads than writes(=3Dchanges) an=
d=20
nobody cared to introduce locking as we usually don't see the race effects.

[*] Unfortunately we don't know what long enough is as we don't do referenc=
e=20
counting for ifnets (and we shouldn't as it would be a massive performance=
=20
hit).  Waiting for as long a possible or at least for "a very long time"=20
would be a good start though.

=2D-=20
/"\  Best regards,                      | mlaier@freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier@EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News

--nextPart2667997.84cDmJOyTc
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (FreeBSD)

iD8DBQBEmQ27XyyEoT62BG0RAuSNAJ9T860ecON1YzMxUq0Onqr3WiNSngCePihj
u0tmDHLStwNGYK9jZ6MBk28=
=Gpfz
-----END PGP SIGNATURE-----

--nextPart2667997.84cDmJOyTc--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606211113.31621.max>