netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Daniel Gröber" <dxld@darkboxed.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: Fri, 13 Oct 2023 15:43:02 -0700	[thread overview]
Message-ID: <20231013154302.44cc197d@kernel.org> (raw)
In-Reply-To: <20231013153605.487f5a74@kernel.org>

On Fri, 13 Oct 2023 15:36:05 -0700 Jakub Kicinski wrote:
>    kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE);
>    dev_net_set(dev, net);
>    kobject_uevent(&dev->dev.kobj, KOBJ_ADD);

Greg, we seem to have a problem in networking with combined
netns move and name change.

We have this code in __dev_change_net_namespace():

	kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE);
	dev_net_set(dev, net);
	kobject_uevent(&dev->dev.kobj, KOBJ_ADD);

	err = device_rename(&dev->dev, dev->name);

Is there any way we can only get the REMOVE (old name) and ADD
(new name) events, without the move? I.e. silence the rename? 

Daniel is reporting that with current code target netns sees an 
add of an interface with the old (duplicated) name. And then a rename.

Without a silent move best we can do is probably:

	kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE);
	dev_net_set(dev, net);
	err = device_rename(&dev->dev, dev->name);
	kobject_uevent(&dev->dev.kobj, KOBJ_ADD);

which will give us:

	MOVE new-name
	ADD new-name

in target netns, which, hm.

  reply	other threads:[~2023-10-13 22:43 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 [this message]
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
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=20231013154302.44cc197d@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).