diff options
author | Li RongQing <roy.qing.li@gmail.com> | 2012-09-11 17:59:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-13 16:53:46 -0400 |
commit | 5744dd9b71c6b9df944c6a32a000d4a564a2abd7 (patch) | |
tree | 5d40eb61a4152f32fa15afdfded741648cfc28c7 /net/ipv6/route.c | |
parent | fb0af4c74f200e3c4846d91d8f2f8b265450bba7 (diff) |
ipv6: replace write lock with read lock when get route info
geting route info does not write rt->rt6i_table, so replace
write lock with read lock
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index f568ac697987..83dafa528936 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -1837,7 +1837,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net, | |||
1837 | if (!table) | 1837 | if (!table) |
1838 | return NULL; | 1838 | return NULL; |
1839 | 1839 | ||
1840 | write_lock_bh(&table->tb6_lock); | 1840 | read_lock_bh(&table->tb6_lock); |
1841 | fn = fib6_locate(&table->tb6_root, prefix ,prefixlen, NULL, 0); | 1841 | fn = fib6_locate(&table->tb6_root, prefix ,prefixlen, NULL, 0); |
1842 | if (!fn) | 1842 | if (!fn) |
1843 | goto out; | 1843 | goto out; |
@@ -1853,7 +1853,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net, | |||
1853 | break; | 1853 | break; |
1854 | } | 1854 | } |
1855 | out: | 1855 | out: |
1856 | write_unlock_bh(&table->tb6_lock); | 1856 | read_unlock_bh(&table->tb6_lock); |
1857 | return rt; | 1857 | return rt; |
1858 | } | 1858 | } |
1859 | 1859 | ||
@@ -1896,7 +1896,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev | |||
1896 | if (!table) | 1896 | if (!table) |
1897 | return NULL; | 1897 | return NULL; |
1898 | 1898 | ||
1899 | write_lock_bh(&table->tb6_lock); | 1899 | read_lock_bh(&table->tb6_lock); |
1900 | for (rt = table->tb6_root.leaf; rt; rt=rt->dst.rt6_next) { | 1900 | for (rt = table->tb6_root.leaf; rt; rt=rt->dst.rt6_next) { |
1901 | if (dev == rt->dst.dev && | 1901 | if (dev == rt->dst.dev && |
1902 | ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) && | 1902 | ((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) && |
@@ -1905,7 +1905,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev | |||
1905 | } | 1905 | } |
1906 | if (rt) | 1906 | if (rt) |
1907 | dst_hold(&rt->dst); | 1907 | dst_hold(&rt->dst); |
1908 | write_unlock_bh(&table->tb6_lock); | 1908 | read_unlock_bh(&table->tb6_lock); |
1909 | return rt; | 1909 | return rt; |
1910 | } | 1910 | } |
1911 | 1911 | ||