diff options
author | Eric Dumazet <edumazet@google.com> | 2012-07-25 01:11:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-25 18:24:14 -0400 |
commit | 4331debc51ee1ce319f4a389484e0e8e05de2aca (patch) | |
tree | 84eafe4afed26328cfe3098ff7103c1222d70aa8 /net/ipv4/route.c | |
parent | 6d8d2dd8ad92ec89f540e73b7a46c5835a7a06a6 (diff) |
ipv4: rt_cache_valid must check expired routes
commit d2d68ba9fe8 (ipv4: Cache input routes in fib_info nexthops.)
introduced rt_cache_valid() helper. It unfortunately doesn't check if
route is expired before caching it.
I noticed sk_setup_caps() was constantly called on a tcp workload.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 6bcb8fc71cbc..3f7bb7185c50 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -444,7 +444,7 @@ static inline int ip_rt_proc_init(void) | |||
444 | } | 444 | } |
445 | #endif /* CONFIG_PROC_FS */ | 445 | #endif /* CONFIG_PROC_FS */ |
446 | 446 | ||
447 | static inline int rt_is_expired(struct rtable *rth) | 447 | static inline bool rt_is_expired(const struct rtable *rth) |
448 | { | 448 | { |
449 | return rth->rt_genid != rt_genid(dev_net(rth->dst.dev)); | 449 | return rth->rt_genid != rt_genid(dev_net(rth->dst.dev)); |
450 | } | 450 | } |
@@ -1222,9 +1222,11 @@ static void rt_cache_route(struct fib_nh *nh, struct rtable *rt) | |||
1222 | } | 1222 | } |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | static bool rt_cache_valid(struct rtable *rt) | 1225 | static bool rt_cache_valid(const struct rtable *rt) |
1226 | { | 1226 | { |
1227 | return (rt && rt->dst.obsolete == DST_OBSOLETE_FORCE_CHK); | 1227 | return rt && |
1228 | rt->dst.obsolete == DST_OBSOLETE_FORCE_CHK && | ||
1229 | !rt_is_expired(rt); | ||
1228 | } | 1230 | } |
1229 | 1231 | ||
1230 | static void rt_set_nexthop(struct rtable *rt, __be32 daddr, | 1232 | static void rt_set_nexthop(struct rtable *rt, __be32 daddr, |