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

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jun 18 03:29:08 PDT 2015


We'll check a bit later if we still need this patch,
sysfs should be already virtualized, so it's unclear why do we need it.

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 06/15/2015 07:37 PM, Kirill Tkhai wrote:
> 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 ++++++++-----
>  scripts/basic/fixdep |  Bin
>  scripts/kconfig/conf |  Bin
>  3 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 8e9bce7..b33ab9a 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