From owner-freebsd-net@FreeBSD.ORG Thu Dec 13 18:15:24 2007 Return-Path: Delivered-To: net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5E2416A41B for ; Thu, 13 Dec 2007 18:15:24 +0000 (UTC) (envelope-from Stephen.Clark@seclark.us) Received: from smtpauth03.prod.mesa1.secureserver.net (smtpauth03.prod.mesa1.secureserver.net [64.202.165.183]) by mx1.freebsd.org (Postfix) with SMTP id 615D913C45D for ; Thu, 13 Dec 2007 18:15:24 +0000 (UTC) (envelope-from Stephen.Clark@seclark.us) Received: (qmail 27472 invoked from network); 13 Dec 2007 17:47:21 -0000 Received: from unknown (24.144.77.185) by smtpauth03.prod.mesa1.secureserver.net (64.202.165.183) with ESMTP; 13 Dec 2007 17:47:21 -0000 Message-ID: <47617027.3020500@seclark.us> Date: Thu, 13 Dec 2007 12:47:19 -0500 From: Stephen Clark User-Agent: Mozilla Thunderbird 1.0.8-1.1.fc4 (X11/20060501) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Maxime Henrion References: <20071213133817.GC71713@elvis.mu.org> In-Reply-To: <20071213133817.GC71713@elvis.mu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: glebius@FreeBSD.org, net@FreeBSD.org Subject: Re: Deadlock in the routing code X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Stephen.Clark@seclark.us List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2007 18:15:24 -0000 Maxime Henrion wrote: >Replying to myself on this one, sorry about that. > >I said in my previous mail that I didn't know yet what process was >holding the lock of the rtentry that the routed process is dealing >with in rt_setgate(), and I just could verify that it is held by >the swi1: net thread. > >So, in a nutshell: > >- The routed process does its business on the routing socket, that ends up > calling rt_setgate(). While in rt_setgate() it drops the lock on its > rtentry in order to call rtalloc1(). At this point, the routed > process hold the gateway route (rtalloc1() returns it locked), and it > now tries to re-lock the original rtentry. >- At the same time, the swi net thread calls arpresolve() which ends up > calling rt_check(). Then rt_check() locks the rtentry, and tries to > lock the gateway route. > >A classical case of deadlock with mutexes because of different locking >order. Now, it's not obvious to me how to fix it :-). > >Maxime >_______________________________________________ >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" > > > what version of freebsd is this? -- "They that give up essential liberty to obtain temporary safety, deserve neither liberty nor safety." (Ben Franklin) "The course of history shows that as a government grows, liberty decreases." (Thomas Jefferson)