[Devel] [PATCH RHEL7 COMMIT] ve/net: allow to rename devices in non-ve namespaces

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 18 06:46:19 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.14
------>
commit 3111f7921d1d94ba7859233587cc80fc97dc8afb
Author: Kirill Tkhai <ktkhai at odin.com>
Date:   Thu Jun 18 17:46:19 2015 +0400

    ve/net: allow to rename devices in non-ve namespaces
    
    Porting patch diff-ve-net-allow-to-rename-devices-in-non-ve-namespaces
    from 2.6.32.
    
    https://jira.sw.ru/browse/PSBM-29810
    
    Signed-off-by: Andrew Vagin <avagin at openvz.org>
    
    https://jira.sw.ru/browse/PSBM-33645
    Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
---
 net/core/dev.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 47e548d..129dc7b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1097,11 +1097,14 @@ int dev_change_name(struct net_device *dev, const char *newname)
 	}
 
 rollback:
-	ret = device_rename(&dev->dev, dev->name);
-	if (ret) {
-		memcpy(dev->name, oldname, IFNAMSIZ);
-		write_seqcount_end(&devnet_rename_seq);
-		return ret;
+	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;
+		}
 	}
 
 	write_seqcount_end(&devnet_rename_seq);



More information about the Devel mailing list