diff options
author | David S. Miller <davem@davemloft.net> | 2011-02-17 18:37:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-17 18:37:09 -0500 |
commit | 010c2708e536938a2f84d51d625f603b9a8f80ac (patch) | |
tree | bf886bc996e41d8996c24e60ec08a19e551c116e /net/ipv4/route.c | |
parent | 5ada552746685d558d0a8e9e979921c75a41e469 (diff) |
ipv4: Move rcu_read_{lock,unlock}() into ip_route_output_slow().
Simplifies tail of __ip_route_output_key().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 849be48971ec..b2b3c9e0a618 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -2456,6 +2456,7 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp, | |||
2456 | res.r = NULL; | 2456 | res.r = NULL; |
2457 | #endif | 2457 | #endif |
2458 | 2458 | ||
2459 | rcu_read_lock(); | ||
2459 | if (oldflp->fl4_src) { | 2460 | if (oldflp->fl4_src) { |
2460 | err = -EINVAL; | 2461 | err = -EINVAL; |
2461 | if (ipv4_is_multicast(oldflp->fl4_src) || | 2462 | if (ipv4_is_multicast(oldflp->fl4_src) || |
@@ -2617,15 +2618,16 @@ make_route: | |||
2617 | err = rt_intern_hash(hash, rth, rp, NULL, oldflp->oif); | 2618 | err = rt_intern_hash(hash, rth, rp, NULL, oldflp->oif); |
2618 | } | 2619 | } |
2619 | 2620 | ||
2620 | out: return err; | 2621 | out: |
2622 | rcu_read_unlock(); | ||
2623 | return err; | ||
2621 | } | 2624 | } |
2622 | 2625 | ||
2623 | int __ip_route_output_key(struct net *net, struct rtable **rp, | 2626 | int __ip_route_output_key(struct net *net, struct rtable **rp, |
2624 | const struct flowi *flp) | 2627 | const struct flowi *flp) |
2625 | { | 2628 | { |
2626 | unsigned int hash; | ||
2627 | int res; | ||
2628 | struct rtable *rth; | 2629 | struct rtable *rth; |
2630 | unsigned int hash; | ||
2629 | 2631 | ||
2630 | if (!rt_caching(net)) | 2632 | if (!rt_caching(net)) |
2631 | goto slow_output; | 2633 | goto slow_output; |
@@ -2655,10 +2657,7 @@ int __ip_route_output_key(struct net *net, struct rtable **rp, | |||
2655 | rcu_read_unlock_bh(); | 2657 | rcu_read_unlock_bh(); |
2656 | 2658 | ||
2657 | slow_output: | 2659 | slow_output: |
2658 | rcu_read_lock(); | 2660 | return ip_route_output_slow(net, rp, flp); |
2659 | res = ip_route_output_slow(net, rp, flp); | ||
2660 | rcu_read_unlock(); | ||
2661 | return res; | ||
2662 | } | 2661 | } |
2663 | EXPORT_SYMBOL_GPL(__ip_route_output_key); | 2662 | EXPORT_SYMBOL_GPL(__ip_route_output_key); |
2664 | 2663 | ||