Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Feb 2003 21:59:12 +0100
From:      Pawel Jakub Dawidek <nick@garage.freebsd.pl>
To:        freebsd-current@freebsd.org
Subject:   Re: LOR: if_ether.c -> route.c.
Message-ID:  <20030203205912.GB9430@garage.freebsd.pl>
In-Reply-To: <20030203110628.GA9430@garage.freebsd.pl>
References:  <20030203110628.GA9430@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Mon, Feb 03, 2003 at 12:06:28PM +0100, Pawel Jakub Dawidek wrote:
+> We got lock order reversal here:
+> 
+>  1st 0xc0384800 arp mutex (arp mutex) @ /usr/src/sys/netinet/if_ether.c:151
+>  2nd 0xc1886b7c radix node head (radix node head) @ /usr/src/sys/net/route.c:549
+> 
+> Simple backtrace:
+> rtreqest1() [route.c]
+> rtreqest() [route.c]
+> arptfree() [if_ether.c]
+> arptimer() [if_ether.c]

I think that MTX_DUPOK is needed here, so:

--- radix.h.orig	Sun Feb  2 20:07:42 2003
+++ radix.h	Mon Feb  3 21:48:30 2003
@@ -159,7 +159,7 @@
 
 
 #define RADIX_NODE_HEAD_LOCK_INIT(rnh)	\
-    mtx_init(&(rnh)->rnh_mtx, "radix node head", NULL, MTX_DEF | MTX_RECURSE)
+    mtx_init(&(rnh)->rnh_mtx, "radix node head", NULL, MTX_DEF | MTX_RECURSE | MTX_DUPOK)
 #define RADIX_NODE_HEAD_LOCK(rnh)	mtx_lock(&(rnh)->rnh_mtx)
 #define RADIX_NODE_HEAD_UNLOCK(rnh)	mtx_unlock(&(rnh)->rnh_mtx)
 #define RADIX_NODE_HEAD_DESTROY(rnh)	mtx_destroy(&(rnh)->rnh_mtx)

Am I right?
"radix node head" is locked first time in arptimer() and 2nd in rtrequest1().
And (if I understand code well) those locks should be in both functions,
because rtrequest1() is not only called through arptimer(), but also through
other functions that don't lock it eariler.

-- 
Pawel Jakub Dawidek
UNIX Systems Administrator
http://garage.freebsd.pl
Am I Evil? Yes, I Am.

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iQCVAwUBPj7YID/PhmMH/Mf1AQE0QQP/b19cs9k+Z0f2XvVXbOhO4AblPcai9qzv
qxMQXgT0wVrOUhGIR4a7ZppeOp2YFTqJAp0bkvpR+7NZD/Ldu9FvuDs48AA1uadc
JBFRAPgeBuwyXH4kc3u0rHhavzEpGVzDnr8RmaC+EkgtApvy7slDfE23R+ojKUz5
xtKiCnp3pJg=
=9gGb
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030203205912.GB9430>