From owner-svn-src-head@FreeBSD.ORG Wed Dec 17 21:14:34 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 107CD106564A for ; Wed, 17 Dec 2008 21:14:34 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from mail-gx0-f10.google.com (mail-gx0-f10.google.com [209.85.217.10]) by mx1.freebsd.org (Postfix) with ESMTP id 94FBD8FC12 for ; Wed, 17 Dec 2008 21:14:33 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by gxk3 with SMTP id 3so195215gxk.12 for ; Wed, 17 Dec 2008 13:14:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:references:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:x-mailer :mime-version:subject:date:cc; bh=GOCLZwIk1GFDv1fvpwqD0AqXik4bakqKwGCYxBEBsLk=; b=lBjj01IhARP4bKXf3Q0FsvidToVe1TLp37vysuTUx27YfsZJ0Q6kQl8RmcGy/qf/1f o0A14GHsY4bZdN2H4LNxIA5VwCh1K0pWomCsicFbTaN+My2xwd0CZXT6hfdrQdJQHNXp e2W25fd/1Gu3FxWhVXyNWNtyQ+QUnQMm+uWIY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=references:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:x-mailer:mime-version:subject:date:cc; b=fAxa4o0cI+3b3/ajIW4cEElwbBb5NqWYV35xObkAKFurdA6bjrlPnQx0y8WxWpvUWa waBd1KwdB8BSKfe/N8YkK0G3c/lrUTWsjdRsJKMPRsE7o3e7Ig2TLlNylGMxrypz0ou1 UeBugitmnIcpfSyJhyw3CtbQ2AN8Nzi8qHKPY= Received: by 10.142.43.7 with SMTP id q7mr461700wfq.295.1229548472096; Wed, 17 Dec 2008 13:14:32 -0800 (PST) Received: from ?192.168.1.253? (c-67-161-11-34.hsd1.ca.comcast.net [67.161.11.34]) by mx.google.com with ESMTPS id 30sm3220484wfd.24.2008.12.17.13.14.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 17 Dec 2008 13:14:31 -0800 (PST) References: <200812170433.mBH4XqkH057618@svn.freebsd.org> Message-Id: From: Kip Macy To: Robert Watson In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Mailer: iPhone Mail (5G77) Mime-Version: 1.0 (iPhone Mail 5G77) Date: Wed, 17 Dec 2008 13:14:27 -0800 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Kip Macy 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 21:14:34 -0000 Yes. On Dec 17, 2008, at 6:49, Robert Watson 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); >> } >> >>