netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net v2] net/ipv6: do not copy dst flags on rt init
@ 2018-09-17 17:20 Peter Oskolkov
  2018-09-17 17:27 ` David Ahern
  2018-09-18  2:43 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Oskolkov @ 2018-09-17 17:20 UTC (permalink / raw)
  To: David Miller, netdev; +Cc: Peter Oskolkov, David Ahern

DST_NOCOUNT in dst_entry::flags tracks whether the entry counts
toward route cache size (net->ipv6.sysctl.ip6_rt_max_size).

If the flag is NOT set, dst_ops::pcpuc_entries counter is incremented
in dist_init() and decremented in dst_destroy().

This flag is tied to allocation/deallocation of dst_entry and
should not be copied from another dst/route. Otherwise it can happen
that dst_ops::pcpuc_entries counter grows until no new routes can
be allocated because the counter reached ip6_rt_max_size due to
DST_NOCOUNT not set and thus no counter decrements on gc-ed routes.

Fixes: 3b6761d18bc1 ("net/ipv6: Move dst flags to booleans in fib entries")
Cc: David Ahern <dsahern@gmail.com>
Acked-by: Wei Wang <weiwan@google.com>
Signed-off-by: Peter Oskolkov <posk@google.com>
---
 net/ipv6/route.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 3eed045c65a5..480a79f47c52 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -946,8 +946,6 @@ static void ip6_rt_init_dst_reject(struct rt6_info *rt, struct fib6_info *ort)
 
 static void ip6_rt_init_dst(struct rt6_info *rt, struct fib6_info *ort)
 {
-	rt->dst.flags |= fib6_info_dst_flags(ort);
-
 	if (ort->fib6_flags & RTF_REJECT) {
 		ip6_rt_init_dst_reject(rt, ort);
 		return;
-- 
2.19.0.397.gdd90340f6a-goog

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Patch net v2] net/ipv6: do not copy dst flags on rt init
  2018-09-17 17:20 [Patch net v2] net/ipv6: do not copy dst flags on rt init Peter Oskolkov
@ 2018-09-17 17:27 ` David Ahern
  2018-09-18  2:43 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2018-09-17 17:27 UTC (permalink / raw)
  To: Peter Oskolkov, David Miller, netdev

On 9/17/18 10:20 AM, Peter Oskolkov wrote:
> DST_NOCOUNT in dst_entry::flags tracks whether the entry counts
> toward route cache size (net->ipv6.sysctl.ip6_rt_max_size).
> 
> If the flag is NOT set, dst_ops::pcpuc_entries counter is incremented
> in dist_init() and decremented in dst_destroy().
> 
> This flag is tied to allocation/deallocation of dst_entry and
> should not be copied from another dst/route. Otherwise it can happen
> that dst_ops::pcpuc_entries counter grows until no new routes can
> be allocated because the counter reached ip6_rt_max_size due to
> DST_NOCOUNT not set and thus no counter decrements on gc-ed routes.
> 
> Fixes: 3b6761d18bc1 ("net/ipv6: Move dst flags to booleans in fib entries")
> Cc: David Ahern <dsahern@gmail.com>
> Acked-by: Wei Wang <weiwan@google.com>
> Signed-off-by: Peter Oskolkov <posk@google.com>
> ---
>  net/ipv6/route.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 3eed045c65a5..480a79f47c52 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -946,8 +946,6 @@ static void ip6_rt_init_dst_reject(struct rt6_info *rt, struct fib6_info *ort)
>  
>  static void ip6_rt_init_dst(struct rt6_info *rt, struct fib6_info *ort)
>  {
> -	rt->dst.flags |= fib6_info_dst_flags(ort);
> -
>  	if (ort->fib6_flags & RTF_REJECT) {
>  		ip6_rt_init_dst_reject(rt, ort);
>  		return;
> 

Reviewed-by: David Ahern <dsahern@gmail.com>

Thanks for the patch.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch net v2] net/ipv6: do not copy dst flags on rt init
  2018-09-17 17:20 [Patch net v2] net/ipv6: do not copy dst flags on rt init Peter Oskolkov
  2018-09-17 17:27 ` David Ahern
@ 2018-09-18  2:43 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-09-18  2:43 UTC (permalink / raw)
  To: posk; +Cc: netdev, dsahern

From: Peter Oskolkov <posk@google.com>
Date: Mon, 17 Sep 2018 10:20:53 -0700

> DST_NOCOUNT in dst_entry::flags tracks whether the entry counts
> toward route cache size (net->ipv6.sysctl.ip6_rt_max_size).
> 
> If the flag is NOT set, dst_ops::pcpuc_entries counter is incremented
> in dist_init() and decremented in dst_destroy().
> 
> This flag is tied to allocation/deallocation of dst_entry and
> should not be copied from another dst/route. Otherwise it can happen
> that dst_ops::pcpuc_entries counter grows until no new routes can
> be allocated because the counter reached ip6_rt_max_size due to
> DST_NOCOUNT not set and thus no counter decrements on gc-ed routes.
> 
> Fixes: 3b6761d18bc1 ("net/ipv6: Move dst flags to booleans in fib entries")
> Cc: David Ahern <dsahern@gmail.com>
> Acked-by: Wei Wang <weiwan@google.com>
> Signed-off-by: Peter Oskolkov <posk@google.com>

Applied and queued up for -stable, thank you.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-18  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-17 17:20 [Patch net v2] net/ipv6: do not copy dst flags on rt init Peter Oskolkov
2018-09-17 17:27 ` David Ahern
2018-09-18  2:43 ` 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).