From: David Miller <davem@davemloft.net>
To: lucien.xin@gmail.com
Cc: netdev@vger.kernel.org, jon.maloy@ericsson.com,
ying.xue@windriver.com, tipc-discussion@lists.sourceforge.net
Subject: Re: [PATCH net] tipc: change to use register_pernet_device
Date: Sat, 22 Jun 2019 16:54:14 -0700 (PDT) [thread overview]
Message-ID: <20190622.165414.71029280359569399.davem@davemloft.net> (raw)
In-Reply-To: <1a8f3ada3e0a65b6e9250c4580a7c420b4ddddac.1561027168.git.lucien.xin@gmail.com>
From: Xin Long <lucien.xin@gmail.com>
Date: Thu, 20 Jun 2019 18:39:28 +0800
> This patch is to fix a dst defcnt leak, which can be reproduced by doing:
>
> # ip net a c; ip net a s; modprobe tipc
> # ip net e s ip l a n eth1 type veth peer n eth1 netns c
> # ip net e c ip l s lo up; ip net e c ip l s eth1 up
> # ip net e s ip l s lo up; ip net e s ip l s eth1 up
> # ip net e c ip a a 1.1.1.2/8 dev eth1
> # ip net e s ip a a 1.1.1.1/8 dev eth1
> # ip net e c tipc b e m udp n u1 localip 1.1.1.2
> # ip net e s tipc b e m udp n u1 localip 1.1.1.1
> # ip net d c; ip net d s; rmmod tipc
>
> and it will get stuck and keep logging the error:
>
> unregister_netdevice: waiting for lo to become free. Usage count = 1
>
> The cause is that a dst is held by the udp sock's sk_rx_dst set on udp rx
> path with udp_early_demux == 1, and this dst (eventually holding lo dev)
> can't be released as bearer's removal in tipc pernet .exit happens after
> lo dev's removal, default_device pernet .exit.
>
> "There are two distinct types of pernet_operations recognized: subsys and
> device. At creation all subsys init functions are called before device
> init functions, and at destruction all device exit functions are called
> before subsys exit function."
>
> So by calling register_pernet_device instead to register tipc_net_ops, the
> pernet .exit() will be invoked earlier than loopback dev's removal when a
> netns is being destroyed, as fou/gue does.
>
> Note that vxlan and geneve udp tunnels don't have this issue, as the udp
> sock is released in their device ndo_stop().
>
> This fix is also necessary for tipc dst_cache, which will hold dsts on tx
> path and I will introduce in my next patch.
>
> Reported-by: Li Shuang <shuali@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
Applied.
prev parent reply other threads:[~2019-06-22 23:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-20 10:39 [PATCH net] tipc: change to use register_pernet_device Xin Long
2019-06-20 12:53 ` Jon Maloy
2019-06-22 23:54 ` David Miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190622.165414.71029280359569399.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=jon.maloy@ericsson.com \
--cc=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox