PERFORCE change 126346 for review

Kip Macy kmacy at FreeBSD.org
Wed Sep 12 16:38:17 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126346

Change 126346 by kmacy at kmacy_home:ethng on 2007/09/12 23:38:04

	narrow the scope of the rnh lock so we don't recurse on it in rtrequest
	make sure we drop the route lock before destroying it

Affected files ...

.. //depot/projects/ethng/src/sys/net/route.c#4 edit

Differences ...

==== //depot/projects/ethng/src/sys/net/route.c#4 (text+ko) ====

@@ -153,6 +153,7 @@
 		 */
 		newrt = rt = RNTORT(rn);
 		nflags = rt->rt_flags & ~ignflags;
+		RADIX_NODE_HEAD_UNLOCK_SHARED(rnh);
 		if (report && (nflags & RTF_CLONING)) {
 			/*
 			 * We are apparently adding (report = 0 in delete).
@@ -162,12 +163,17 @@
 			err = rtrequest(RTM_RESOLVE, dst, NULL,
 					      NULL, 0, &newrt);
 			if (err) {
+				RADIX_NODE_HEAD_LOCK_SHARED(rnh);
+				if (!((rn = rnh->rnh_matchaddr(dst, rnh)) &&
+					(rn->rn_flags & RNF_ROOT) == 0)) 
+					goto miss;
 				/*
 				 * If the cloning didn't succeed, maybe
 				 * what we have will do. Return that.
 				 */
 				newrt = rt;		/* existing route */
 				RT_LOCK(newrt);
+				RADIX_NODE_HEAD_UNLOCK_SHARED(rnh);
 				RT_ADDREF(newrt);
 				goto miss;
 			}
@@ -197,7 +203,6 @@
 			RT_LOCK(newrt);
 			RT_ADDREF(newrt);
 		}
-		RADIX_NODE_HEAD_UNLOCK_SHARED(rnh);
 	} else {
 		/*
 		 * Either we hit the root or couldn't find any match,
@@ -297,6 +302,7 @@
 		/*
 		 * and the rtentry itself of course
 		 */
+		RT_UNLOCK(rt);
 		RT_LOCK_DESTROY(rt);
 		uma_zfree(rtzone, rt);
 		return;


More information about the p4-projects mailing list