[Devel] [PATCH RHEL7 COMMIT] ve/net: Don't skip device_rename() for non-root Container netns
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Feb 22 21:23:29 MSK 2023
The commit is pushed to "branch-rh7-3.10.0-1160.83.1.vz7.194.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.83.1.vz7.194.4
------>
commit 6e89993f44b2715942f2da8ee0d6f7757c5a594b
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date: Wed Feb 22 18:59:58 2023 +0800
ve/net: Don't skip device_rename() for non-root Container netns
This patch effectively reverts the commit:
c6ac86bac9ce ("ve/net: allow to rename devices in non-ve namespaces")
The patch says that it allows to rename devices, but instead it skips
call to device_rename() for non-root netnses of the container.
Ending up with not renamed sysfs link for the renamed device.
And if such inconsistent device with different device name and sysfs
name is moved to root netns of Container the systemd-udevd gets an event
notification about it with mixed names.
Systemd obviousely does not expect this and goes mad if at the same time
old moved device name intersects with some other device name in root
netns of Container, thus systemd disables this other device (e.g. eth0
and breaks Container network).
The original patch from vz6
diff-ve-net-allow-to-rename-devices-in-non-ve-namespaces
seems just to be a crutch for
diff-ve-vedev-dont-call-netdev_fixup_sysfs-if-device_add-was-not-called
so that sysfs entries of vedev don't break on netns creation.
But as we don't have the latter (in vz7 device cgroups eliminated all
crunches of that kind - https://jira.sw.ru/browse/PSBM-17918)
now we also don't need the former.
https://jira.sw.ru/browse/PSBM-145324
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
net/core/dev.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index ec3e2d31c203..addd254c9c3c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1196,14 +1196,11 @@ int dev_change_name(struct net_device *dev, const char *newname)
}
rollback:
- if (!dev_net(dev)->owner_ve->ve_netns ||
- dev_net(dev)->owner_ve->ve_netns == dev->nd_net) {
- ret = device_rename(&dev->dev, dev->name);
- if (ret) {
- memcpy(dev->name, oldname, IFNAMSIZ);
- write_seqcount_end(&devnet_rename_seq);
- return ret;
- }
+ ret = device_rename(&dev->dev, dev->name);
+ if (ret) {
+ memcpy(dev->name, oldname, IFNAMSIZ);
+ write_seqcount_end(&devnet_rename_seq);
+ return ret;
}
write_seqcount_end(&devnet_rename_seq);
More information about the Devel
mailing list