diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-06-03 00:13:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-03 23:01:51 -0400 |
commit | 4736022844fe694c4ee971fa2b6c1cb38dadbc78 (patch) | |
tree | 0eafa36fe68d886c152548bfc367627a57fe4dd5 /net/ipv4/route.c | |
parent | bc10502dba37d3b210efd9f3867212298f13b78e (diff) |
ipv4: RCU changes in __mkroute_input()
Avoid two atomic ops on output device refcount
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.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, 3 insertions, 5 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 1cfe0d199e7c..7b8eacd5ac26 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1957,22 +1957,22 @@ static void ip_handle_martian_source(struct net_device *dev, | |||
1957 | #endif | 1957 | #endif |
1958 | } | 1958 | } |
1959 | 1959 | ||
1960 | /* called in rcu_read_lock() section */ | ||
1960 | static int __mkroute_input(struct sk_buff *skb, | 1961 | static int __mkroute_input(struct sk_buff *skb, |
1961 | struct fib_result *res, | 1962 | struct fib_result *res, |
1962 | struct in_device *in_dev, | 1963 | struct in_device *in_dev, |
1963 | __be32 daddr, __be32 saddr, u32 tos, | 1964 | __be32 daddr, __be32 saddr, u32 tos, |
1964 | struct rtable **result) | 1965 | struct rtable **result) |
1965 | { | 1966 | { |
1966 | |||
1967 | struct rtable *rth; | 1967 | struct rtable *rth; |
1968 | int err; | 1968 | int err; |
1969 | struct in_device *out_dev; | 1969 | struct in_device *out_dev; |
1970 | unsigned flags = 0; | 1970 | unsigned int flags = 0; |
1971 | __be32 spec_dst; | 1971 | __be32 spec_dst; |
1972 | u32 itag; | 1972 | u32 itag; |
1973 | 1973 | ||
1974 | /* get a working reference to the output device */ | 1974 | /* get a working reference to the output device */ |
1975 | out_dev = in_dev_get(FIB_RES_DEV(*res)); | 1975 | out_dev = __in_dev_get_rcu(FIB_RES_DEV(*res)); |
1976 | if (out_dev == NULL) { | 1976 | if (out_dev == NULL) { |
1977 | if (net_ratelimit()) | 1977 | if (net_ratelimit()) |
1978 | printk(KERN_CRIT "Bug in ip_route_input" \ | 1978 | printk(KERN_CRIT "Bug in ip_route_input" \ |
@@ -2053,8 +2053,6 @@ static int __mkroute_input(struct sk_buff *skb, | |||
2053 | *result = rth; | 2053 | *result = rth; |
2054 | err = 0; | 2054 | err = 0; |
2055 | cleanup: | 2055 | cleanup: |
2056 | /* release the working reference to the output device */ | ||
2057 | in_dev_put(out_dev); | ||
2058 | return err; | 2056 | return err; |
2059 | } | 2057 | } |
2060 | 2058 | ||