From owner-freebsd-current@FreeBSD.ORG Thu Jan 29 15:22:02 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CFD6116A4CE for ; Thu, 29 Jan 2004 15:22:02 -0800 (PST) Received: from farside.isc.org (farside.isc.org [204.152.187.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2117243D3F for ; Thu, 29 Jan 2004 15:22:02 -0800 (PST) (envelope-from David_Hankins@isc.org) Received: by farside.isc.org (Postfix, from userid 10200) id 102F7A82B; Thu, 29 Jan 2004 23:22:02 +0000 (UTC) Date: Thu, 29 Jan 2004 23:22:02 +0000 From: "David W. Hankins" To: freebsd-current@freebsd.org Message-ID: <20040129232201.GD56062@isc.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Subject: 5.2-rel, route.c question X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jan 2004 23:22:02 -0000 While looking at rtalloc1 in depth, trying to figure out the recursive lock Peter mailed here a little while ago, I noticed something unrelated about rtalloc1 I was hoping someone could explain to me. At route.c:161 (cvs vers 1.92.2.1), I notice that it locks the rt pointer it plans on returning, but does not inc the reference count. The other two execution paths of rtalloc1 both lock & inc the ref count. And later, in rtrequest1 (route.c:784), a call to rtalloc1 is made, and in one case RTFREE_LOCKED(rt) is used, in the other rtexpunge is used which looks safe to me either way. but... IFF rtalloc1 did not RT_ADDREF(), AND rtrequest1 RTFREE_LOCKED()'s it, then will the rt not be freed out from under the other reference? And badness can then ensue? I'm hoping someone more familiar with the code can tell me I'm wrong. I've never read a line of it until today, so it's probable I'm just confused. -- David W. Hankins "If you don't do it right the first time, you'll just have to do it again." -- Jack T. Hankins