From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CA61107AD for ; Fri, 13 Oct 2023 22:43:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tKmjpQzW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4BB8C433C8; Fri, 13 Oct 2023 22:43:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697236984; bh=tWTCttui4UFyt2yeWYK9aIb7UBMshVr8qR5BhDqrXNw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tKmjpQzWW/VWRluLD4JeRBorppjaZOyu92+11TACEcSPm0MIbe19kTLiEpQPh6Oca Xqdu8P3nXtvgRQFC9Wj9V+UZ6d8pPCUmGEwOBDW9OM0z9/H5D2Q9U/3pg7OKWgvaSQ G5mD/630665MNRz2AZiULwyJjNdNUZgWefA1GEOvpR3QFl+PxKKEu3wX4f4lAjBGxs TV+9igkGDxkeQkq7EhCIAEG8/5yVFvc7mu7MS6CF6k2uOOlq+eO71Lokz78B+x6l/w hOOOcbW3fFppnLnFQcIexWN6XpEzRnldI8WNutPU5MVqrYXReK0Zre+5k5u99TKQ+I fto+fFjjdhCXw== Date: Fri, 13 Oct 2023 15:43:02 -0700 From: Jakub Kicinski To: Greg Kroah-Hartman Cc: Daniel =?UTF-8?B?R3LDtmJlcg==?= , "David S. Miller" , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, Richard Weinberger , Serge Hallyn , "Eric W. Biederman" Subject: Re: [BUG] rtnl_newlink: Rogue MOVE event delivered on netns change Message-ID: <20231013154302.44cc197d@kernel.org> In-Reply-To: <20231013153605.487f5a74@kernel.org> References: <20231010121003.x3yi6fihecewjy4e@House.clients.dxld.at> <20231013153605.487f5a74@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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.