* [PATCH net-next] ipv6: Remove fallback argument from ip6_hold_safe
@ 2019-03-20 16:24 David Ahern
2019-03-20 16:57 ` Wei Wang
2019-03-21 20:30 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: David Ahern @ 2019-03-20 16:24 UTC (permalink / raw)
To: davem, netdev; +Cc: weiwan, David Ahern
From: David Ahern <dsahern@gmail.com>
net and null_fallback are redundant. Remove null_fallback in favor of
!net check.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
net/ipv6/route.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 4ef4bbdb49d4..c9a2f0f2dea6 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1015,14 +1015,13 @@ static struct fib6_node* fib6_backtrack(struct fib6_node *fn,
}
}
-static bool ip6_hold_safe(struct net *net, struct rt6_info **prt,
- bool null_fallback)
+static bool ip6_hold_safe(struct net *net, struct rt6_info **prt)
{
struct rt6_info *rt = *prt;
if (dst_hold_safe(&rt->dst))
return true;
- if (null_fallback) {
+ if (net) {
rt = net->ipv6.ip6_null_entry;
dst_hold(&rt->dst);
} else {
@@ -1089,7 +1088,7 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net,
/* Search through exception table */
rt = rt6_find_cached_rt(f6i, &fl6->daddr, &fl6->saddr);
if (rt) {
- if (ip6_hold_safe(net, &rt, true))
+ if (ip6_hold_safe(net, &rt))
dst_use_noref(&rt->dst, jiffies);
} else if (f6i == net->ipv6.fib6_null_entry) {
rt = net->ipv6.ip6_null_entry;
@@ -1240,7 +1239,7 @@ static struct rt6_info *rt6_get_pcpu_route(struct fib6_info *rt)
pcpu_rt = *p;
if (pcpu_rt)
- ip6_hold_safe(NULL, &pcpu_rt, false);
+ ip6_hold_safe(NULL, &pcpu_rt);
return pcpu_rt;
}
@@ -1865,7 +1864,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
/*Search through exception table */
rt = rt6_find_cached_rt(f6i, &fl6->daddr, &fl6->saddr);
if (rt) {
- if (ip6_hold_safe(net, &rt, true))
+ if (ip6_hold_safe(net, &rt))
dst_use_noref(&rt->dst, jiffies);
rcu_read_unlock();
@@ -2480,7 +2479,7 @@ static struct rt6_info *__ip6_route_redirect(struct net *net,
out:
if (ret)
- ip6_hold_safe(net, &ret, true);
+ ip6_hold_safe(net, &ret);
else
ret = ip6_create_rt_rcu(rt);
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] ipv6: Remove fallback argument from ip6_hold_safe
2019-03-20 16:24 [PATCH net-next] ipv6: Remove fallback argument from ip6_hold_safe David Ahern
@ 2019-03-20 16:57 ` Wei Wang
2019-03-21 20:30 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Wei Wang @ 2019-03-20 16:57 UTC (permalink / raw)
To: David Ahern
Cc: David S . Miller, Linux Kernel Network Developers, David Ahern
On Wed, Mar 20, 2019 at 9:24 AM David Ahern <dsahern@kernel.org> wrote:
>
> From: David Ahern <dsahern@gmail.com>
>
> net and null_fallback are redundant. Remove null_fallback in favor of
> !net check.
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> ---
Acked-by: Wei Wang <weiwan@google.com>
> net/ipv6/route.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 4ef4bbdb49d4..c9a2f0f2dea6 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1015,14 +1015,13 @@ static struct fib6_node* fib6_backtrack(struct fib6_node *fn,
> }
> }
>
> -static bool ip6_hold_safe(struct net *net, struct rt6_info **prt,
> - bool null_fallback)
> +static bool ip6_hold_safe(struct net *net, struct rt6_info **prt)
> {
> struct rt6_info *rt = *prt;
>
> if (dst_hold_safe(&rt->dst))
> return true;
> - if (null_fallback) {
> + if (net) {
> rt = net->ipv6.ip6_null_entry;
> dst_hold(&rt->dst);
> } else {
> @@ -1089,7 +1088,7 @@ static struct rt6_info *ip6_pol_route_lookup(struct net *net,
> /* Search through exception table */
> rt = rt6_find_cached_rt(f6i, &fl6->daddr, &fl6->saddr);
> if (rt) {
> - if (ip6_hold_safe(net, &rt, true))
> + if (ip6_hold_safe(net, &rt))
> dst_use_noref(&rt->dst, jiffies);
> } else if (f6i == net->ipv6.fib6_null_entry) {
> rt = net->ipv6.ip6_null_entry;
> @@ -1240,7 +1239,7 @@ static struct rt6_info *rt6_get_pcpu_route(struct fib6_info *rt)
> pcpu_rt = *p;
>
> if (pcpu_rt)
> - ip6_hold_safe(NULL, &pcpu_rt, false);
> + ip6_hold_safe(NULL, &pcpu_rt);
>
> return pcpu_rt;
> }
> @@ -1865,7 +1864,7 @@ struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
> /*Search through exception table */
> rt = rt6_find_cached_rt(f6i, &fl6->daddr, &fl6->saddr);
> if (rt) {
> - if (ip6_hold_safe(net, &rt, true))
> + if (ip6_hold_safe(net, &rt))
> dst_use_noref(&rt->dst, jiffies);
>
> rcu_read_unlock();
> @@ -2480,7 +2479,7 @@ static struct rt6_info *__ip6_route_redirect(struct net *net,
>
> out:
> if (ret)
> - ip6_hold_safe(net, &ret, true);
> + ip6_hold_safe(net, &ret);
> else
> ret = ip6_create_rt_rcu(rt);
>
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] ipv6: Remove fallback argument from ip6_hold_safe
2019-03-20 16:24 [PATCH net-next] ipv6: Remove fallback argument from ip6_hold_safe David Ahern
2019-03-20 16:57 ` Wei Wang
@ 2019-03-21 20:30 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-03-21 20:30 UTC (permalink / raw)
To: dsahern; +Cc: netdev, weiwan, dsahern
From: David Ahern <dsahern@kernel.org>
Date: Wed, 20 Mar 2019 09:24:50 -0700
> From: David Ahern <dsahern@gmail.com>
>
> net and null_fallback are redundant. Remove null_fallback in favor of
> !net check.
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-21 20:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 16:24 [PATCH net-next] ipv6: Remove fallback argument from ip6_hold_safe David Ahern
2019-03-20 16:57 ` Wei Wang
2019-03-21 20:30 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).