[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iLJrrJs+6Vc==Un4rVKcpV0Eof4F_4w1_wQGxUCE2FWAg@mail.gmail.com>
Date: Tue, 6 Feb 2024 11:22:23 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Antoine Tenart <atenart@...nel.org>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org, eric.dumazet@...il.com
Subject: Re: [PATCH v3 net-next 05/15] geneve: use exit_batch_rtnl() method
On Tue, Feb 6, 2024 at 10:19 AM Antoine Tenart <atenart@...nel.org> wrote:
>
> Quoting Eric Dumazet (2024-02-05 13:47:42)
> > -static void __net_exit geneve_exit_batch_net(struct list_head *net_list)
> > +static void __net_exit geneve_exit_batch_rtnl(struct list_head *net_list,
> > + struct list_head *dev_to_kill)
> > {
> > struct net *net;
> > - LIST_HEAD(list);
> >
> > - rtnl_lock();
> > list_for_each_entry(net, net_list, exit_list)
> > - geneve_destroy_tunnels(net, &list);
> > -
> > - /* unregister the devices gathered above */
> > - unregister_netdevice_many(&list);
> > - rtnl_unlock();
> > + geneve_destroy_tunnels(net, dev_to_kill);
> >
> > list_for_each_entry(net, net_list, exit_list) {
> > const struct geneve_net *gn = net_generic(net, geneve_net_id);
>
> Not shown in the diff here is:
>
> WARN_ON_ONCE(!list_empty(&gn->sock_list));
>
> I think this will be triggered as the above logic inverted two calls,
> which are now,
>
> 1. WARN_ON_ONCE(...)
> 2. unregister_netdevice_many
>
> But ->sock_list entries are removed in ndo_exit, called from
> unregister_netdevice_many.
>
> I guess the warning could be moved to exit_batch (or removed).
I will keep the warning, but move it, thanks [1]
Speaking of geneve, I think the synchronize_net() call from
geneve_sock_release() could easily be avoided.
[1] I will squash the following delta for v4 submission.
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index f31fc52ef397dfe0eba854385f783fbcad7e870f..23e97c2e4f6fcb90a8bbb117d7520397f560f15f
100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -1907,17 +1907,19 @@ static void __net_exit
geneve_exit_batch_rtnl(struct list_head *net_list,
list_for_each_entry(net, net_list, exit_list)
geneve_destroy_tunnels(net, dev_to_kill);
+}
- list_for_each_entry(net, net_list, exit_list) {
- const struct geneve_net *gn = net_generic(net, geneve_net_id);
+static void __net_exit geneve_exit_net(struct net *net)
+{
+ const struct geneve_net *gn = net_generic(net, geneve_net_id);
- WARN_ON_ONCE(!list_empty(&gn->sock_list));
- }
+ WARN_ON_ONCE(!list_empty(&gn->sock_list));
}
static struct pernet_operations geneve_net_ops = {
.init = geneve_init_net,
.exit_batch_rtnl = geneve_exit_batch_rtnl,
+ .exit = geneve_exit_net,
.id = &geneve_net_id,
.size = sizeof(struct geneve_net),
};
Powered by blists - more mailing lists