netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Daniel Gröber" <dxld@darkboxed.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, Richard Weinberger <richard@nod.at>,
	Serge Hallyn <serge.hallyn@canonical.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: [BUG] rtnl_newlink: Rogue MOVE event delivered on netns change
Date: Mon, 16 Oct 2023 18:45:14 -0700	[thread overview]
Message-ID: <20231016184514.5dda6518@kernel.org> (raw)
In-Reply-To: <20231017012024.pp2riikutr54ini4@House.clients.dxld.at>

On Tue, 17 Oct 2023 03:20:24 +0200 Daniel Gröber wrote:
> > 1. we have tb[IFLA_IFNAME] set, so do_setlink() will populate ifname
> > 
> > 2. Because of #1, __dev_change_net_namespace() gets called with 
> >    new name provide (pat = eth123)
> > 
> > 3. It will do netdev_name_in_use(), which returns true.  
> 
> At this point we're still looking at the old netns, right?

New one, already. We got it from the caller and the caller
from rtnl_link_get_net_capable().

> > 7. Now we finally call:
> > 
> >    err = device_rename(&dev->dev, dev->name);
> > 
> > Which tells device core that the name has changed, and gives you 
> > the (second) MOVE event. This time with the correct name.  
> 
> I don't like loose ends. Any idea why we only see the one MOVE now?

No, annoyingly I haven't. But I do have a host on 5.19.

[ ~]# uname -r
5.19.13-200.fc36.x86_64
[ ~]# ip netns add test
[ ~]# udevadm monitor -k &
[ ~]# ip li add name eth0 type dummy
KERNEL[67.377539] add      /module/dummy (module)
KERNEL[67.381720] add      /devices/virtual/net/eth0 (net)
KERNEL[67.381822] add      /devices/virtual/net/eth0/queues/rx-0 (queues)
KERNEL[67.381854] add      /devices/virtual/net/eth0/queues/tx-0 (queues)
[ ~]# ip -netns test li add name eth0 type dummy
[ ~]# ip -netns test link set dev eth0 netns 1 name eth1
KERNEL[99.681956] add      /devices/virtual/net/eth0 (net)
KERNEL[99.681975] move     /devices/virtual/net/eth1 (net)

I don't see it on older kernels either :S

  reply	other threads:[~2023-10-17  1:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10 12:10 [BUG] rtnl_newlink: Rogue MOVE event delivered on netns change Daniel Gröber
2023-10-13 22:36 ` Jakub Kicinski
2023-10-13 22:43   ` Jakub Kicinski
2023-10-14  8:58     ` Greg Kroah-Hartman
2023-10-16 14:32       ` Jakub Kicinski
2023-10-16 17:20         ` Greg Kroah-Hartman
2023-10-16 19:03           ` Jakub Kicinski
2023-10-17  1:20           ` Daniel Gröber
2023-10-17  1:45             ` Jakub Kicinski [this message]
2023-11-11  2:13               ` [RFC net-next] net: do not send a MOVE event when netdev changes netns Jakub Kicinski

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=20231016184514.5dda6518@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dxld@darkboxed.org \
    --cc=ebiederm@xmission.com \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richard@nod.at \
    --cc=serge.hallyn@canonical.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;
as well as URLs for NNTP newsgroup(s).