Commit 5744dd9b authored by Li RongQing's avatar Li RongQing Committed by David S. Miller

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: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarLi RongQing <roy.qing.li@gmail.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fb0af4c7
...@@ -1708,7 +1708,7 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx, ...@@ -1708,7 +1708,7 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx,
if (table == NULL) if (table == NULL)
return NULL; return NULL;
write_lock_bh(&table->tb6_lock); read_lock_bh(&table->tb6_lock);
fn = fib6_locate(&table->tb6_root, pfx, plen, NULL, 0); fn = fib6_locate(&table->tb6_root, pfx, plen, NULL, 0);
if (!fn) if (!fn)
goto out; goto out;
...@@ -1723,7 +1723,7 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx, ...@@ -1723,7 +1723,7 @@ static struct rt6_info *addrconf_get_prefix_route(const struct in6_addr *pfx,
break; break;
} }
out: out:
write_unlock_bh(&table->tb6_lock); read_unlock_bh(&table->tb6_lock);
return rt; return rt;
} }
......
...@@ -1837,7 +1837,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net, ...@@ -1837,7 +1837,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
if (!table) if (!table)
return NULL; return NULL;
write_lock_bh(&table->tb6_lock); read_lock_bh(&table->tb6_lock);
fn = fib6_locate(&table->tb6_root, prefix ,prefixlen, NULL, 0); fn = fib6_locate(&table->tb6_root, prefix ,prefixlen, NULL, 0);
if (!fn) if (!fn)
goto out; goto out;
...@@ -1853,7 +1853,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net, ...@@ -1853,7 +1853,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
break; break;
} }
out: out:
write_unlock_bh(&table->tb6_lock); read_unlock_bh(&table->tb6_lock);
return rt; return rt;
} }
...@@ -1896,7 +1896,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev ...@@ -1896,7 +1896,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev
if (!table) if (!table)
return NULL; return NULL;
write_lock_bh(&table->tb6_lock); read_lock_bh(&table->tb6_lock);
for (rt = table->tb6_root.leaf; rt; rt=rt->dst.rt6_next) { for (rt = table->tb6_root.leaf; rt; rt=rt->dst.rt6_next) {
if (dev == rt->dst.dev && if (dev == rt->dst.dev &&
((rt->rt6i_flags & (RTF_ADDRCONF | RTF_DEFAULT)) == (RTF_ADDRCONF | RTF_DEFAULT)) && ((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,7 +1905,7 @@ struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr, struct net_dev
} }
if (rt) if (rt)
dst_hold(&rt->dst); dst_hold(&rt->dst);
write_unlock_bh(&table->tb6_lock); read_unlock_bh(&table->tb6_lock);
return rt; return rt;
} }
......
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