From owner-freebsd-net@FreeBSD.ORG Fri Sep 5 22:52:39 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45DD4106564A for ; Fri, 5 Sep 2008 22:52:39 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outB.internet-mail-service.net (outb.internet-mail-service.net [216.240.47.225]) by mx1.freebsd.org (Postfix) with ESMTP id 27ACC8FC12 for ; Fri, 5 Sep 2008 22:52:39 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 847A82488 for ; Fri, 5 Sep 2008 15:52:39 -0700 (PDT) Received: from julian-mac.elischer.org (localhost [127.0.0.1]) by idiom.com (Postfix) with ESMTP id 1F34F2D605F for ; Fri, 5 Sep 2008 15:52:37 -0700 (PDT) Message-ID: <48C1B83C.9000404@elischer.org> Date: Fri, 05 Sep 2008 15:52:44 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.16 (Macintosh/20080707) MIME-Version: 1.0 To: FreeBSD Net References: <48C19568.807@elischer.org> <48C1B774.2020405@elischer.org> In-Reply-To: <48C1B774.2020405@elischer.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: rewrite of rt_check() (now rt_check_fib()) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Sep 2008 22:52:39 -0000 Julian Elischer wrote: > Julian Elischer wrote: >> In tryin gto understand rt_check_fib() (wsa rt_check()) I ended up >> rewriting it to do what I thought it was trying to do.. >> this stops the panics some people have seen, but allows the system to >> stay up long enough to see some other problem.. >> anyhow this si the patch: >> >> comments? >> > > I was thinking about this a bit. > > rt_check_fib() drops the lock on the given rtentry in order to be able > to get a lock on another rtentry that MIGHT be the same rtentry. > > while it is doing this, another processor could free the original > rtentry. The only safw way to get around this is to hold an additional > reference on the first rtentry (we don't already have one) while it is > unlocked so that we can be sure that it is not actually freed if this > happens. > > to do this safely I'd have to add a couple of new items into route.h: > > #define RT_TEMP_UNLOCK(_rt) do { \ > RT_ADDREF(_rt); \ > RT_UNLOCK(_rt); \ > } while (0) > > #define RT_RELOCK(_rt) do { \ > RT_LOCK(_rt) \ > if ((_rt)->rt_refcnt <= 1) \ > rtfree(_rt); \ > _rt = 0; /* signal that it went away */ \ > else { \ > RT_REMREF(_rt); \ > RT_UNLOCK(_rt); duh remove that line! \ > /* note that _rt is still valid */ \ > } \ > } while (0) > > > the new version of rt_check is attached..... > > > ------------------------------------------------------------------------ > > _______________________________________________ > freebsd-net@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-net > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"