From owner-svn-src-head@FreeBSD.ORG Wed Dec 17 14:49:29 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93B281065674; Wed, 17 Dec 2008 14:49:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 7162E8FC17; Wed, 17 Dec 2008 14:49:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTP id 019A546B0D; Wed, 17 Dec 2008 09:49:29 -0500 (EST) Date: Wed, 17 Dec 2008 14:49:28 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Kip Macy In-Reply-To: <200812170433.mBH4XqkH057618@svn.freebsd.org> Message-ID: References: <200812170433.mBH4XqkH057618@svn.freebsd.org> User-Agent: Alpine 1.10 (BSF 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r186209 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Dec 2008 14:49:29 -0000 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); > } > >