patch-2.0.35 linux/include/net/route.h

Next file: linux/include/net/sock.h
Previous file: linux/include/net/rosecall.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.34/linux/include/net/route.h linux/include/net/route.h
@@ -131,12 +131,10 @@
 extern __inline__ void ip_rt_put(struct rtable * rt)
 #ifndef MODULE
 {
-	if (rt)
-		atomic_dec(&rt->rt_refcnt);
-
-	/* If this rtable entry is not in the cache, we'd better free it once the
-	 * refcnt goes to zero, because nobody else will... */
-	if ( rt && (rt->rt_flags & RTF_NOTCACHED) && (!rt->rt_refcnt) )
+	/* If this rtable entry is not in the cache, we'd better free
+	 * it once the refcnt goes to zero, because nobody else will.
+	 */
+	if (rt&&atomic_dec_and_test(&rt->rt_refcnt)&&(rt->rt_flags&RTF_NOTCACHED))
 		rt_free(rt);
 }
 #else

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov