From patchwork Wed Aug 9 10:42:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuznetsov X-Patchwork-Id: 799646 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xS7BN0nZXz9s76 for ; Wed, 9 Aug 2017 20:42:20 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119AbdHIKmG (ORCPT ); Wed, 9 Aug 2017 06:42:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35610 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751722AbdHIKmF (ORCPT ); Wed, 9 Aug 2017 06:42:05 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F3912419F2; Wed, 9 Aug 2017 10:42:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F3912419F2 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=vkuznets@redhat.com Received: from vitty.brq.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id 933E27E90F; Wed, 9 Aug 2017 10:42:03 +0000 (UTC) From: Vitaly Kuznetsov To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Stephen Hemminger Subject: [PATCH RFC net-next] net: Allow name change of IFF_UP interfaces Date: Wed, 9 Aug 2017 12:42:02 +0200 Message-Id: <20170809104202.30959-1-vkuznets@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 09 Aug 2017 10:42:05 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Recent 'transparenf VF' changes to netvsc driver made VF interfaces register as netvsc interface slaves upon appearance. This led to udev not being able to rename the interface according to the 'predictable interface names' scheme: kernel: mlx4_core 0002:00:02.0 eth2: joined to eth1 kernel: hv_netvsc 33b7a6f9-6736-451f-8fce-b382eaa50bee eth1: VF registering: eth2 kernel: mlx4_en: eth2: Link Up kernel: hv_netvsc 33b7a6f9-6736-451f-8fce-b382eaa50bee eth1: Data path switched to VF: eth2 systemd-udevd[1785]: Error changing net interface name 'eth2' to 'enP2p0s2': Device or resource busy systemd-udevd[1785]: could not rename interface '5' from 'eth2' to 'enP2p0s2': Device or resource busy What happens is: __netvsc_vf_setup() does dev_open() for the VF device and the consecutive dev_change_name() fails with -EBUSY because of the (dev->flags & IFF_UP) check. The history of this code predates git so I wasn't able to figure out when and why the check was added, everything seems to work fine without it. dev_change_name() has only two call sites, both hold rtnl_lock. Signed-off-by: Vitaly Kuznetsov --- RFC: I'm probably miossing something obvious and the check can't be just dropped. Stephen suggested a different solution to the isuue: https://www.spinics.net/lists/netdev/msg448243.html but it has its own drawbacks. --- net/core/dev.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 1d75499add72..c608e233a78a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1186,8 +1186,6 @@ int dev_change_name(struct net_device *dev, const char *newname) BUG_ON(!dev_net(dev)); net = dev_net(dev); - if (dev->flags & IFF_UP) - return -EBUSY; write_seqcount_begin(&devnet_rename_seq);