diff options
author | Amerigo Wang <amwang@redhat.com> | 2012-09-09 22:48:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-10 16:31:18 -0400 |
commit | fdd6681d92a70b3db73cdb61c6b4053f2f8003b3 (patch) | |
tree | 15a050d4fd0ffd4082fefcd9d2ad454b0c06218f /net/ipv6 | |
parent | 6d57e9078e880a3dd232d579f42ac437a8f1ef7b (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')
-rw-r--r-- | net/ipv6/ip6_output.c | 13 | ||||
-rw-r--r-- | net/ipv6/route.c | 15 |
2 files changed, 4 insertions, 24 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index a4f6263fddc..3dd4a37488d 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -123,16 +123,11 @@ static int ip6_finish_output2(struct sk_buff *skb) | |||
123 | skb->len); | 123 | skb->len); |
124 | } | 124 | } |
125 | 125 | ||
126 | rcu_read_lock(); | ||
127 | rt = (struct rt6_info *) dst; | 126 | rt = (struct rt6_info *) dst; |
128 | neigh = rt->n; | 127 | neigh = rt->n; |
129 | if (neigh) { | 128 | if (neigh) |
130 | int res = dst_neigh_output(dst, neigh, skb); | 129 | return dst_neigh_output(dst, neigh, skb); |
131 | 130 | ||
132 | rcu_read_unlock(); | ||
133 | return res; | ||
134 | } | ||
135 | rcu_read_unlock(); | ||
136 | IP6_INC_STATS_BH(dev_net(dst->dev), | 131 | IP6_INC_STATS_BH(dev_net(dst->dev), |
137 | ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); | 132 | ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); |
138 | kfree_skb(skb); | 133 | kfree_skb(skb); |
@@ -983,7 +978,6 @@ static int ip6_dst_lookup_tail(struct sock *sk, | |||
983 | * dst entry and replace it instead with the | 978 | * dst entry and replace it instead with the |
984 | * dst entry of the nexthop router | 979 | * dst entry of the nexthop router |
985 | */ | 980 | */ |
986 | rcu_read_lock(); | ||
987 | rt = (struct rt6_info *) *dst; | 981 | rt = (struct rt6_info *) *dst; |
988 | n = rt->n; | 982 | n = rt->n; |
989 | if (n && !(n->nud_state & NUD_VALID)) { | 983 | if (n && !(n->nud_state & NUD_VALID)) { |
@@ -991,7 +985,6 @@ static int ip6_dst_lookup_tail(struct sock *sk, | |||
991 | struct flowi6 fl_gw6; | 985 | struct flowi6 fl_gw6; |
992 | int redirect; | 986 | int redirect; |
993 | 987 | ||
994 | rcu_read_unlock(); | ||
995 | ifp = ipv6_get_ifaddr(net, &fl6->saddr, | 988 | ifp = ipv6_get_ifaddr(net, &fl6->saddr, |
996 | (*dst)->dev, 1); | 989 | (*dst)->dev, 1); |
997 | 990 | ||
@@ -1011,8 +1004,6 @@ static int ip6_dst_lookup_tail(struct sock *sk, | |||
1011 | if ((err = (*dst)->error)) | 1004 | if ((err = (*dst)->error)) |
1012 | goto out_err_release; | 1005 | goto out_err_release; |
1013 | } | 1006 | } |
1014 | } else { | ||
1015 | rcu_read_unlock(); | ||
1016 | } | 1007 | } |
1017 | #endif | 1008 | #endif |
1018 | 1009 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index a81c6790a64..399613b7972 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 | } |
473 | out: | ||
474 | rcu_read_unlock(); | ||
475 | } | 472 | } |
476 | #else | 473 | #else |
477 | static inline void rt6_probe(struct rt6_info *rt) | 474 | static 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, |