[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJ-ah6N5OwDEsJAcNmjdDvJQjMoj-_iAaxSkYmfPt5PQA@mail.gmail.com>
Date: Thu, 30 May 2024 19:46:38 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
David Ahern <dsahern@...nel.org>, Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH net-next 3/3] dst_cache: let rt_uncached cope with
dst_cache cleanup
On Thu, May 30, 2024 at 7:21 PM Paolo Abeni <pabeni@...hat.com> wrote:
>
> Eric reported that dst_cache don't cope correctly with device removal,
> keeping the cached dst unmodified even when the underlining device is
> deleted and the dst itself is not uncached.
>
> The above causes the infamous 'unregistering netdevice' hangup.
>
> Address the issue by adding each entry held by the dst_caches to the
> 'uncached' list, so that the dst core will cleanup the device reference
> at device removal time.
>
> Reported-by: Eric Dumazet <edumazet@...gle.com>
> Suggested-by: Eric Dumazet <edumazet@...gle.com>
> Fixes: 911362c70df5 ("net: add dst_cache support")
> Signed-off-by: Paolo Abeni <pabeni@...hat.com>
> ---
> net/core/dst_cache.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/net/core/dst_cache.c b/net/core/dst_cache.c
> index 6a0482e676d3..d1cb852d5748 100644
> --- a/net/core/dst_cache.c
> +++ b/net/core/dst_cache.c
> @@ -11,6 +11,7 @@
> #include <net/route.h>
> #if IS_ENABLED(CONFIG_IPV6)
> #include <net/ip6_fib.h>
> +#include <net/ip6_route.h>
> #endif
> #include <uapi/linux/in.h>
>
> @@ -28,6 +29,7 @@ static void dst_cache_per_cpu_dst_set(struct dst_cache_pcpu *dst_cache,
> struct dst_entry *dst, u32 cookie)
> {
> dst_release(dst_cache->dst);
> +
> if (dst)
> dst_hold(dst);
>
> @@ -98,6 +100,9 @@ void dst_cache_set_ip4(struct dst_cache *dst_cache, struct dst_entry *dst,
>
> idst = this_cpu_ptr(dst_cache->cache);
> dst_cache_per_cpu_dst_set(idst, dst, 0);
> + if (dst && list_empty(&dst->rt_uncached))
> + rt_add_uncached_list(dst_rtable(dst));
> +
> idst->in_saddr.s_addr = saddr;
> }
> EXPORT_SYMBOL_GPL(dst_cache_set_ip4);
> @@ -114,6 +119,9 @@ void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst,
> idst = this_cpu_ptr(dst_cache->cache);
> dst_cache_per_cpu_dst_set(idst, dst,
> rt6_get_cookie(dst_rt6_info(dst)));
> + if (dst && list_empty(&dst->rt_uncached))
> + rt6_uncached_list_add(dst_rt6_info(dst));
This probably will not compile if CONFIG_IPV6=m ?
Powered by blists - more mailing lists