diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2014-09-11 18:35:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-13 16:38:42 -0400 |
commit | 6c555490e0ce885a9caf0a045db69382a3ccbc9c (patch) | |
tree | bf9d222108cd0c0c8257d8a42551bb9c1eaba48a /net/ipv6 | |
parent | 8801d48cbde6ddd275c1e6b866e434a72cafeabd (diff) |
ipv6: drop useless rcu_read_lock() in anycast
These code is now protected by rtnl lock, rcu read lock
is useless now.
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/anycast.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c index ff2de7d9d8e6..3b0429bc6b5a 100644 --- a/net/ipv6/anycast.c +++ b/net/ipv6/anycast.c | |||
@@ -78,7 +78,6 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
78 | pac->acl_addr = *addr; | 78 | pac->acl_addr = *addr; |
79 | 79 | ||
80 | rtnl_lock(); | 80 | rtnl_lock(); |
81 | rcu_read_lock(); | ||
82 | if (ifindex == 0) { | 81 | if (ifindex == 0) { |
83 | struct rt6_info *rt; | 82 | struct rt6_info *rt; |
84 | 83 | ||
@@ -91,11 +90,11 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
91 | goto error; | 90 | goto error; |
92 | } else { | 91 | } else { |
93 | /* router, no matching interface: just pick one */ | 92 | /* router, no matching interface: just pick one */ |
94 | dev = dev_get_by_flags_rcu(net, IFF_UP, | 93 | dev = __dev_get_by_flags(net, IFF_UP, |
95 | IFF_UP | IFF_LOOPBACK); | 94 | IFF_UP | IFF_LOOPBACK); |
96 | } | 95 | } |
97 | } else | 96 | } else |
98 | dev = dev_get_by_index_rcu(net, ifindex); | 97 | dev = __dev_get_by_index(net, ifindex); |
99 | 98 | ||
100 | if (dev == NULL) { | 99 | if (dev == NULL) { |
101 | err = -ENODEV; | 100 | err = -ENODEV; |
@@ -137,7 +136,6 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
137 | } | 136 | } |
138 | 137 | ||
139 | error: | 138 | error: |
140 | rcu_read_unlock(); | ||
141 | rtnl_unlock(); | 139 | rtnl_unlock(); |
142 | if (pac) | 140 | if (pac) |
143 | sock_kfree_s(sk, pac, sizeof(*pac)); | 141 | sock_kfree_s(sk, pac, sizeof(*pac)); |
@@ -174,11 +172,9 @@ int ipv6_sock_ac_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) | |||
174 | spin_unlock_bh(&ipv6_sk_ac_lock); | 172 | spin_unlock_bh(&ipv6_sk_ac_lock); |
175 | 173 | ||
176 | rtnl_lock(); | 174 | rtnl_lock(); |
177 | rcu_read_lock(); | 175 | dev = __dev_get_by_index(net, pac->acl_ifindex); |
178 | dev = dev_get_by_index_rcu(net, pac->acl_ifindex); | ||
179 | if (dev) | 176 | if (dev) |
180 | ipv6_dev_ac_dec(dev, &pac->acl_addr); | 177 | ipv6_dev_ac_dec(dev, &pac->acl_addr); |
181 | rcu_read_unlock(); | ||
182 | rtnl_unlock(); | 178 | rtnl_unlock(); |
183 | 179 | ||
184 | sock_kfree_s(sk, pac, sizeof(*pac)); | 180 | sock_kfree_s(sk, pac, sizeof(*pac)); |
@@ -203,12 +199,11 @@ void ipv6_sock_ac_close(struct sock *sk) | |||
203 | 199 | ||
204 | prev_index = 0; | 200 | prev_index = 0; |
205 | rtnl_lock(); | 201 | rtnl_lock(); |
206 | rcu_read_lock(); | ||
207 | while (pac) { | 202 | while (pac) { |
208 | struct ipv6_ac_socklist *next = pac->acl_next; | 203 | struct ipv6_ac_socklist *next = pac->acl_next; |
209 | 204 | ||
210 | if (pac->acl_ifindex != prev_index) { | 205 | if (pac->acl_ifindex != prev_index) { |
211 | dev = dev_get_by_index_rcu(net, pac->acl_ifindex); | 206 | dev = __dev_get_by_index(net, pac->acl_ifindex); |
212 | prev_index = pac->acl_ifindex; | 207 | prev_index = pac->acl_ifindex; |
213 | } | 208 | } |
214 | if (dev) | 209 | if (dev) |
@@ -216,7 +211,6 @@ void ipv6_sock_ac_close(struct sock *sk) | |||
216 | sock_kfree_s(sk, pac, sizeof(*pac)); | 211 | sock_kfree_s(sk, pac, sizeof(*pac)); |
217 | pac = next; | 212 | pac = next; |
218 | } | 213 | } |
219 | rcu_read_unlock(); | ||
220 | rtnl_unlock(); | 214 | rtnl_unlock(); |
221 | } | 215 | } |
222 | 216 | ||
@@ -341,7 +335,7 @@ int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr) | |||
341 | return 0; | 335 | return 0; |
342 | } | 336 | } |
343 | 337 | ||
344 | /* called with rcu_read_lock() */ | 338 | /* called with rtnl_lock() */ |
345 | static int ipv6_dev_ac_dec(struct net_device *dev, const struct in6_addr *addr) | 339 | static int ipv6_dev_ac_dec(struct net_device *dev, const struct in6_addr *addr) |
346 | { | 340 | { |
347 | struct inet6_dev *idev = __in6_dev_get(dev); | 341 | struct inet6_dev *idev = __in6_dev_get(dev); |