Subject: [PATCH] nethost ipv4: minor updates From: Eric W. Biederman Date: 1137525976 -0700 - Document our dependency on the RTNL lock, inet_host_fini - Update to work with the new version of dst_alloc in route.c and xfrm4_policy.c --- net/ipv4/af_inet.c | 3 +++ net/ipv4/route.c | 16 ++++++++-------- net/ipv4/xfrm4_policy.c | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) cd1fac6f4194826073c602a2c1e6f92b1501ccf4 diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 5957878..8661c32 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -247,6 +247,9 @@ static int inet_host_init(struct nethost static void inet_host_fini(struct nethost *host) { struct ip_host *ihost; + + ASSERT_RTNL(); + ihost = host->ip_host; host->ip_host = NULL; diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 7508079..c5a659a 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -150,7 +150,7 @@ static void ipv4_dst_ifdown(struct dst static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst); static void ipv4_link_failure(struct sk_buff *skb); static void ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu); -static int rt_garbage_collect(void); +static int rt_garbage_collect(struct nethost *host); static struct dst_ops ipv4_dst_ops = { @@ -764,7 +764,7 @@ static void rt_secret_rebuild(unsigned l and when load increases it reduces to limit cache size. */ -static int rt_garbage_collect(void) +static int rt_garbage_collect(struct nethost *host) { static unsigned long expire = RT_GC_TIMEOUT; static unsigned long last_gc; @@ -1008,7 +1008,7 @@ restart: int saved_int = ip_rt_gc_min_interval; ip_rt_gc_elasticity = 1; ip_rt_gc_min_interval = 0; - rt_garbage_collect(); + rt_garbage_collect(rt->fl.host); ip_rt_gc_min_interval = saved_int; ip_rt_gc_elasticity = saved_elasticity; goto restart; @@ -1172,7 +1172,7 @@ void ip_rt_redirect(u32 old_gw, u32 dadd dst_hold(&rth->u.dst); rcu_read_unlock(); - rt = dst_alloc(&ipv4_dst_ops); + rt = dst_alloc(&ipv4_dst_ops, dev->host); if (rt == NULL) { ip_rt_put(rth); in_dev_put(in_dev); @@ -1621,7 +1621,7 @@ static int ip_route_input_mc(struct sk_b dev, &spec_dst, &itag) < 0) goto e_inval; - rth = dst_alloc(&ipv4_dst_ops); + rth = dst_alloc(&ipv4_dst_ops, host); if (!rth) goto e_nobufs; @@ -1761,7 +1761,7 @@ static inline int __mkroute_input(struct } - rth = dst_alloc(&ipv4_dst_ops); + rth = dst_alloc(&ipv4_dst_ops, in_dev->dev->host); if (!rth) { err = -ENOBUFS; goto cleanup; @@ -2015,7 +2015,7 @@ brd_input: RT_CACHE_STAT_INC(in_brd); local_input: - rth = dst_alloc(&ipv4_dst_ops); + rth = dst_alloc(&ipv4_dst_ops, fl.host); if (!rth) goto e_nobufs; @@ -2213,7 +2213,7 @@ static inline int __mkroute_output(struc } - rth = dst_alloc(&ipv4_dst_ops); + rth = dst_alloc(&ipv4_dst_ops, fl->host); if (!rth) { err = -ENOBUFS; goto cleanup; diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 7eb9d65..2e20d48 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c @@ -84,7 +84,7 @@ __xfrm4_bundle_create(struct xfrm_policy dst_hold(&rt->u.dst); for (i = 0; i < nx; i++) { - struct dst_entry *dst1 = dst_alloc(&xfrm4_dst_ops); + struct dst_entry *dst1 = dst_alloc(&xfrm4_dst_ops, fl->host); struct xfrm_dst *xdst; int tunnel = 0; @@ -241,7 +241,7 @@ _decode_session4(struct sk_buff *skb, st fl->fl4_src = iph->saddr; } -static inline int xfrm4_garbage_collect(void) +static inline int xfrm4_garbage_collect(struct nethost *host) { read_lock(&xfrm4_policy_afinfo.lock); xfrm4_policy_afinfo.garbage_collect(); -- 1.0.GIT