提交 010c2708 编写于 作者: D David S. Miller

ipv4: Move rcu_read_{lock,unlock}() into ip_route_output_slow().

Simplifies tail of __ip_route_output_key().
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 5ada5527
...@@ -2456,6 +2456,7 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp, ...@@ -2456,6 +2456,7 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
res.r = NULL; res.r = NULL;
#endif #endif
rcu_read_lock();
if (oldflp->fl4_src) { if (oldflp->fl4_src) {
err = -EINVAL; err = -EINVAL;
if (ipv4_is_multicast(oldflp->fl4_src) || if (ipv4_is_multicast(oldflp->fl4_src) ||
...@@ -2617,15 +2618,16 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp, ...@@ -2617,15 +2618,16 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
err = rt_intern_hash(hash, rth, rp, NULL, oldflp->oif); err = rt_intern_hash(hash, rth, rp, NULL, oldflp->oif);
} }
out: return err; out:
rcu_read_unlock();
return err;
} }
int __ip_route_output_key(struct net *net, struct rtable **rp, int __ip_route_output_key(struct net *net, struct rtable **rp,
const struct flowi *flp) const struct flowi *flp)
{ {
unsigned int hash;
int res;
struct rtable *rth; struct rtable *rth;
unsigned int hash;
if (!rt_caching(net)) if (!rt_caching(net))
goto slow_output; goto slow_output;
...@@ -2655,10 +2657,7 @@ int __ip_route_output_key(struct net *net, struct rtable **rp, ...@@ -2655,10 +2657,7 @@ int __ip_route_output_key(struct net *net, struct rtable **rp,
rcu_read_unlock_bh(); rcu_read_unlock_bh();
slow_output: slow_output:
rcu_read_lock(); return ip_route_output_slow(net, rp, flp);
res = ip_route_output_slow(net, rp, flp);
rcu_read_unlock();
return res;
} }
EXPORT_SYMBOL_GPL(__ip_route_output_key); EXPORT_SYMBOL_GPL(__ip_route_output_key);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册