aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorAmerigo Wang <amwang@redhat.com>2012-09-09 22:48:44 -0400
committerDavid S. Miller <davem@davemloft.net>2012-09-10 16:31:18 -0400
commitfdd6681d92a70b3db73cdb61c6b4053f2f8003b3 (patch)
tree15a050d4fd0ffd4082fefcd9d2ad454b0c06218f /net/ipv6/route.c
parent6d57e9078e880a3dd232d579f42ac437a8f1ef7b (diff)
ipv6: remove some useless RCU read lock
After this commit: commit 97cac0821af4474ec4ba3a9e7a36b98ed9b6db88 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: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index a81c6790a648..399613b7972f 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -451,10 +451,9 @@ static void rt6_probe(struct rt6_info *rt)
451 * Router Reachability Probe MUST be rate-limited 451 * Router Reachability Probe MUST be rate-limited
452 * to no more than one per minute. 452 * to no more than one per minute.
453 */ 453 */
454 rcu_read_lock();
455 neigh = rt ? rt->n : NULL; 454 neigh = rt ? rt->n : NULL;
456 if (!neigh || (neigh->nud_state & NUD_VALID)) 455 if (!neigh || (neigh->nud_state & NUD_VALID))
457 goto out; 456 return;
458 read_lock_bh(&neigh->lock); 457 read_lock_bh(&neigh->lock);
459 if (!(neigh->nud_state & NUD_VALID) && 458 if (!(neigh->nud_state & NUD_VALID) &&
460 time_after(jiffies, neigh->updated + rt->rt6i_idev->cnf.rtr_probe_interval)) { 459 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 } else { 469 } else {
471 read_unlock_bh(&neigh->lock); 470 read_unlock_bh(&neigh->lock);
472 } 471 }
473out:
474 rcu_read_unlock();
475} 472}
476#else 473#else
477static inline void rt6_probe(struct rt6_info *rt) 474static inline void rt6_probe(struct rt6_info *rt)
@@ -498,7 +495,6 @@ static inline int rt6_check_neigh(struct rt6_info *rt)
498 struct neighbour *neigh; 495 struct neighbour *neigh;
499 int m; 496 int m;
500 497
501 rcu_read_lock();
502 neigh = rt->n; 498 neigh = rt->n;
503 if (rt->rt6i_flags & RTF_NONEXTHOP || 499 if (rt->rt6i_flags & RTF_NONEXTHOP ||
504 !(rt->rt6i_flags & RTF_GATEWAY)) 500 !(rt->rt6i_flags & RTF_GATEWAY))
@@ -516,7 +512,6 @@ static inline int rt6_check_neigh(struct rt6_info *rt)
516 read_unlock_bh(&neigh->lock); 512 read_unlock_bh(&neigh->lock);
517 } else 513 } else
518 m = 0; 514 m = 0;
519 rcu_read_unlock();
520 return m; 515 return m;
521} 516}
522 517
@@ -2496,15 +2491,11 @@ static int rt6_fill_node(struct net *net,
2496 if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0) 2491 if (rtnetlink_put_metrics(skb, dst_metrics_ptr(&rt->dst)) < 0)
2497 goto nla_put_failure; 2492 goto nla_put_failure;
2498 2493
2499 rcu_read_lock();
2500 n = rt->n; 2494 n = rt->n;
2501 if (n) { 2495 if (n) {
2502 if (nla_put(skb, RTA_GATEWAY, 16, &n->primary_key) < 0) { 2496 if (nla_put(skb, RTA_GATEWAY, 16, &n->primary_key) < 0)
2503 rcu_read_unlock();
2504 goto nla_put_failure; 2497 goto nla_put_failure;
2505 }
2506 } 2498 }
2507 rcu_read_unlock();
2508 2499
2509 if (rt->dst.dev && 2500 if (rt->dst.dev &&
2510 nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex)) 2501 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#else 2697#else
2707 seq_puts(m, "00000000000000000000000000000000 00 "); 2698 seq_puts(m, "00000000000000000000000000000000 00 ");
2708#endif 2699#endif
2709 rcu_read_lock();
2710 n = rt->n; 2700 n = rt->n;
2711 if (n) { 2701 if (n) {
2712 seq_printf(m, "%pi6", n->primary_key); 2702 seq_printf(m, "%pi6", n->primary_key);
2713 } else { 2703 } else {
2714 seq_puts(m, "00000000000000000000000000000000"); 2704 seq_puts(m, "00000000000000000000000000000000");
2715 } 2705 }
2716 rcu_read_unlock();
2717 seq_printf(m, " %08x %08x %08x %08x %8s\n", 2706 seq_printf(m, " %08x %08x %08x %08x %8s\n",
2718 rt->rt6i_metric, atomic_read(&rt->dst.__refcnt), 2707 rt->rt6i_metric, atomic_read(&rt->dst.__refcnt),
2719 rt->dst.__use, rt->rt6i_flags, 2708 rt->dst.__use, rt->rt6i_flags,