diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-06-14 00:46:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-15 02:13:07 -0400 |
commit | c68f24cc354050415c5ea543cd19ea5424463a2f (patch) | |
tree | 13921fd85a8d7f4fa38ddfafba3bf7a9592190b2 /net/ipv6 | |
parent | f6bc7d9e4760324258ad5f5d147e79db8442842e (diff) |
ipv6: RCU changes in ipv6_get_mtu() and ip6_dst_hoplimit()
Use RCU to avoid atomic ops on idev refcnt in ipv6_get_mtu()
and ip6_dst_hoplimit()
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/route.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index f7702850d45c..8f2d0400cf8a 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1084,11 +1084,11 @@ static int ipv6_get_mtu(struct net_device *dev) | |||
1084 | int mtu = IPV6_MIN_MTU; | 1084 | int mtu = IPV6_MIN_MTU; |
1085 | struct inet6_dev *idev; | 1085 | struct inet6_dev *idev; |
1086 | 1086 | ||
1087 | idev = in6_dev_get(dev); | 1087 | rcu_read_lock(); |
1088 | if (idev) { | 1088 | idev = __in6_dev_get(dev); |
1089 | if (idev) | ||
1089 | mtu = idev->cnf.mtu6; | 1090 | mtu = idev->cnf.mtu6; |
1090 | in6_dev_put(idev); | 1091 | rcu_read_unlock(); |
1091 | } | ||
1092 | return mtu; | 1092 | return mtu; |
1093 | } | 1093 | } |
1094 | 1094 | ||
@@ -1097,12 +1097,15 @@ int ip6_dst_hoplimit(struct dst_entry *dst) | |||
1097 | int hoplimit = dst_metric(dst, RTAX_HOPLIMIT); | 1097 | int hoplimit = dst_metric(dst, RTAX_HOPLIMIT); |
1098 | if (hoplimit < 0) { | 1098 | if (hoplimit < 0) { |
1099 | struct net_device *dev = dst->dev; | 1099 | struct net_device *dev = dst->dev; |
1100 | struct inet6_dev *idev = in6_dev_get(dev); | 1100 | struct inet6_dev *idev; |
1101 | if (idev) { | 1101 | |
1102 | rcu_read_lock(); | ||
1103 | idev = __in6_dev_get(dev); | ||
1104 | if (idev) | ||
1102 | hoplimit = idev->cnf.hop_limit; | 1105 | hoplimit = idev->cnf.hop_limit; |
1103 | in6_dev_put(idev); | 1106 | else |
1104 | } else | ||
1105 | hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit; | 1107 | hoplimit = dev_net(dev)->ipv6.devconf_all->hop_limit; |
1108 | rcu_read_unlock(); | ||
1106 | } | 1109 | } |
1107 | return hoplimit; | 1110 | return hoplimit; |
1108 | } | 1111 | } |