Commit fdd6681d authored by Amerigo Wang's avatar Amerigo Wang Committed by David S. Miller

ipv6: remove some useless RCU read lock

After this commit:
	commit 97cac082
	Author: David S. Miller <davem@davemloft.net>
	Date:   Mon Jul 2 22:43:47 2012 -0700

	    ipv6: Store route neighbour in rt6_info struct.

we no longer use RCU to protect route neighbour.

Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: default avatarCong Wang <amwang@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6d57e907
...@@ -123,16 +123,11 @@ static int ip6_finish_output2(struct sk_buff *skb) ...@@ -123,16 +123,11 @@ static int ip6_finish_output2(struct sk_buff *skb)
skb->len); skb->len);
} }
rcu_read_lock();
rt = (struct rt6_info *) dst; rt = (struct rt6_info *) dst;
neigh = rt->n; neigh = rt->n;
if (neigh) { if (neigh)
int res = dst_neigh_output(dst, neigh, skb); return dst_neigh_output(dst, neigh, skb);
rcu_read_unlock();
return res;
}
rcu_read_unlock();
IP6_INC_STATS_BH(dev_net(dst->dev), IP6_INC_STATS_BH(dev_net(dst->dev),
ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
kfree_skb(skb); kfree_skb(skb);
...@@ -983,7 +978,6 @@ static int ip6_dst_lookup_tail(struct sock *sk, ...@@ -983,7 +978,6 @@ static int ip6_dst_lookup_tail(struct sock *sk,
* dst entry and replace it instead with the * dst entry and replace it instead with the
* dst entry of the nexthop router * dst entry of the nexthop router
*/ */
rcu_read_lock();
rt = (struct rt6_info *) *dst; rt = (struct rt6_info *) *dst;
n = rt->n; n = rt->n;
if (n && !(n->nud_state & NUD_VALID)) { if (n && !(n->nud_state & NUD_VALID)) {
...@@ -991,7 +985,6 @@ static int ip6_dst_lookup_tail(struct sock *sk, ...@@ -991,7 +985,6 @@ static int ip6_dst_lookup_tail(struct sock *sk,
struct flowi6 fl_gw6; struct flowi6 fl_gw6;
int redirect; int redirect;
rcu_read_unlock();
ifp = ipv6_get_ifaddr(net, &fl6->saddr, ifp = ipv6_get_ifaddr(net, &fl6->saddr,
(*dst)->dev, 1); (*dst)->dev, 1);
...@@ -1011,8 +1004,6 @@ static int ip6_dst_lookup_tail(struct sock *sk, ...@@ -1011,8 +1004,6 @@ static int ip6_dst_lookup_tail(struct sock *sk,
if ((err = (*dst)->error)) if ((err = (*dst)->error))
goto out_err_release; goto out_err_release;
} }
} else {
rcu_read_unlock();
} }
#endif #endif
......
...@@ -451,10 +451,9 @@ static void rt6_probe(struct rt6_info *rt) ...@@ -451,10 +451,9 @@ static void rt6_probe(struct rt6_info *rt)
* Router Reachability Probe MUST be rate-limited * Router Reachability Probe MUST be rate-limited
* to no more than one per minute. * to no more than one per minute.
*/ */
rcu_read_lock();
neigh = rt ? rt->n : NULL; neigh = rt ? rt->n : NULL;
if (!neigh || (neigh->nud_state & NUD_VALID)) if (!neigh || (neigh->nud_state & NUD_VALID))
goto out; return;
read_lock_bh(&neigh->lock); read_lock_bh(&neigh->lock);
if (!(neigh->nud_state & NUD_VALID) && if (!(neigh->nud_state & NUD_VALID) &&
time_after(jiffies, neigh->updated + rt->rt6i_idev->cnf.rtr_probe_interval)) { time_after(jiffies, neigh->updated + rt->rt6i_idev->cnf.rtr_probe_interval)) {
...@@ -470,8 +469,6 @@ static void rt6_probe(struct rt6_info *rt) ...@@ -470,8 +469,6 @@ static void rt6_probe(struct rt6_info *rt)
} else { } else {
read_unlock_bh(&neigh->lock); read_unlock_bh(&neigh->lock);
} }
out:
rcu_read_unlock();
} }
#else #else
static inline void rt6_probe(struct rt6_info *rt) static inline void rt6_probe(struct rt6_info *rt)
...@@ -498,7 +495,6 @@ static inline int rt6_check_neigh(struct rt6_info *rt) ...@@ -498,7 +495,6 @@ static inline int rt6_check_neigh(struct rt6_info *rt)
struct neighbour *neigh; struct neighbour *neigh;
int m; int m;
rcu_read_lock();
neigh = rt->n; neigh = rt->n;
if (rt->rt6i_flags & RTF_NONEXTHOP || if (rt->rt6i_flags & RTF_NONEXTHOP ||
!(rt->rt6i_flags & RTF_GATEWAY)) !(rt->rt6i_flags & RTF_GATEWAY))
...@@ -516,7 +512,6 @@ static inline int rt6_check_neigh(struct rt6_info *rt) ...@@ -516,7 +512,6 @@ static inline int rt6_check_neigh(struct rt6_info *rt)
read_unlock_bh(&neigh->lock); read_unlock_bh(&neigh->lock);
} else } else
m = 0; m = 0;
rcu_read_unlock();
return m; return m;
} }
...@@ -2496,15 +2491,11 @@ static int rt6_fill_node(struct net *net, ...@@ -2496,15 +2491,11 @@ static int rt6_fill_node(struct net *net,
if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0) if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0)
goto nla_put_failure; goto nla_put_failure;
rcu_read_lock();
n = rt->n; n = rt->n;
if (n) { if (n) {
if (nla_put(skb, RTA_GATEWAY, 16, &n->primary_key) < 0) { if (nla_put(skb, RTA_GATEWAY, 16, &n->primary_key) < 0)
rcu_read_unlock();
goto nla_put_failure; goto nla_put_failure;
}
} }
rcu_read_unlock();
if (rt->dst.dev && if (rt->dst.dev &&
nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex)) nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex))
...@@ -2706,14 +2697,12 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg) ...@@ -2706,14 +2697,12 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg)
#else #else
seq_puts(m, "00000000000000000000000000000000 00 "); seq_puts(m, "00000000000000000000000000000000 00 ");
#endif #endif
rcu_read_lock();
n = rt->n; n = rt->n;
if (n) { if (n) {
seq_printf(m, "%pi6", n->primary_key); seq_printf(m, "%pi6", n->primary_key);
} else { } else {
seq_puts(m, "00000000000000000000000000000000"); seq_puts(m, "00000000000000000000000000000000");
} }
rcu_read_unlock();
seq_printf(m, " %08x %08x %08x %08x %8s\n", seq_printf(m, " %08x %08x %08x %08x %8s\n",
rt->rt6i_metric, atomic_read(&rt->dst.__refcnt), rt->rt6i_metric, atomic_read(&rt->dst.__refcnt),
rt->dst.__use, rt->rt6i_flags, rt->dst.__use, rt->rt6i_flags,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment