svn commit: r186209 - head/sys/net

Kip Macy kmacy at FreeBSD.org
Wed Dec 17 04:33:52 UTC 2008


Author: kmacy
Date: Wed Dec 17 04:33:52 2008
New Revision: 186209
URL: http://svn.freebsd.org/changeset/base/186209

Log:
  avoid trying to acquire a shared lock while holding an exclusive lock
  by making the ifnet lock acquisition exclusive

Modified:
  head/sys/net/if.c

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Wed Dec 17 04:15:38 2008	(r186208)
+++ head/sys/net/if.c	Wed Dec 17 04:33:52 2008	(r186209)
@@ -197,9 +197,9 @@ ifnet_byindex(u_short idx)
 	INIT_VNET_NET(curvnet);
 	struct ifnet *ifp;
 
-	IFNET_RLOCK();
+	IFNET_WLOCK();
 	ifp = V_ifindex_table[idx].ife_ifnet;
-	IFNET_RUNLOCK();
+	IFNET_WUNLOCK();
 	return (ifp);
 }
 
@@ -218,9 +218,9 @@ ifaddr_byindex(u_short idx)
 {
 	struct ifaddr *ifa;
 
-	IFNET_RLOCK();
+	IFNET_WLOCK();
 	ifa = ifnet_byindex(idx)->if_addr;
-	IFNET_RUNLOCK();
+	IFNET_WUNLOCK();
 	return (ifa);
 }
 


More information about the svn-src-head mailing list