Date: Wed, 17 Dec 2008 13:14:27 -0800 From: Kip Macy <mat.macy@gmail.com> To: Robert Watson <rwatson@FreeBSD.org> Cc: "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, Kip Macy <kmacy@FreeBSD.org> Subject: Re: svn commit: r186209 - head/sys/net Message-ID: <F796E1A5-169F-4920-8F5F-BF9F0B059918@gmail.com> In-Reply-To: <alpine.BSF.1.10.0812171448130.75599@fledge.watson.org> References: <200812170433.mBH4XqkH057618@svn.freebsd.org> <alpine.BSF.1.10.0812171448130.75599@fledge.watson.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Yes. On Dec 17, 2008, at 6:49, Robert Watson <rwatson@FreeBSD.org> wrote: > > On Wed, 17 Dec 2008, Kip Macy wrote: > >> Author: kmacy >> Date: Wed Dec 17 04:33:52 2008 >> New Revision: 186209 >> URL: http://svn.freebsd.org/changeset/base/186209 >> >> Log: >> avoid trying to acquire a shared lock while holding an exclusive lock >> by making the ifnet lock acquisition exclusive > > This seems unfortunate as the ifindex arrays get dereferenced a > moderate amount; perhaps ifnet_byindex_locked() and > ifaddr_byindex_locked() should be added for those special-case > callers that are aware of ifnet locking? > > Robert N M Watson > Computer Laboratory > University of Cambridge > >> >> Modified: >> head/sys/net/if.c >> >> Modified: head/sys/net/if.c >> === >> === >> === >> ===================================================================== >> --- head/sys/net/if.c Wed Dec 17 04:15:38 2008 (r186208) >> +++ head/sys/net/if.c Wed Dec 17 04:33:52 2008 (r186209) >> @@ -197,9 +197,9 @@ ifnet_byindex(u_short idx) >> INIT_VNET_NET(curvnet); >> struct ifnet *ifp; >> >> - IFNET_RLOCK(); >> + IFNET_WLOCK(); >> ifp = V_ifindex_table[idx].ife_ifnet; >> - IFNET_RUNLOCK(); >> + IFNET_WUNLOCK(); >> return (ifp); >> } >> >> @@ -218,9 +218,9 @@ ifaddr_byindex(u_short idx) >> { >> struct ifaddr *ifa; >> >> - IFNET_RLOCK(); >> + IFNET_WLOCK(); >> ifa = ifnet_byindex(idx)->if_addr; >> - IFNET_RUNLOCK(); >> + IFNET_WUNLOCK(); >> return (ifa); >> } >> >>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F796E1A5-169F-4920-8F5F-BF9F0B059918>