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: msg51703/pgp00000.pgp
Description: PGP signature

Reply via email to