diff options
author | John Fastabend <john.fastabend@gmail.com> | 2013-10-21 17:28:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-22 19:22:09 -0400 |
commit | 47d4ab91e4472723f181075c81627374ca86816c (patch) | |
tree | b8f3811fd8c623012acecf0feee68290b05ea1a0 /drivers/net/macvlan.c | |
parent | 5378c2e6ea236de847a39bdb6f3aa83137120d26 (diff) |
macvlan: resolve ENOENT errors on creation
After the commit below attempting to create macvlan devices was
resulting in ENOENT errors,
# ip link add link p3p2 type macvlan
RTNETLINK answers: Invalid argument
This happens because netdev_upper_dev_link() is called before
register_netdevice() in the macvlan code. Through a call chain
this results in a call to __netdev_adjacent_dev_insert() and
finally a sysfs_create_link(). This requires the kobject of
the macvlan to be registered which is done in register_netdevice().
If there is no kobject which is the case here the ENOENT error
is seen on the command line.
To resolve this move the netdev_upper_dev_link() call below
the register_netdevice() call. This aligns with vlan driver
flow.
Regression introduced here,
commit 5831d66e8097aedfa3bc35941cf265ada2352317
Author: Veaceslav Falico <vfalico@redhat.com>
Date: Wed Sep 25 09:20:32 2013 +0200
net: create sysfs symlinks for neighbour devices
CC: Veaceslav Falico <vfalico@redhat.com>
CC: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Veaceslav Falico <vfalico@redhat.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macvlan.c')
-rw-r--r-- | drivers/net/macvlan.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 9bf46bd19b87..cc9845ec91c1 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -828,22 +828,21 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev, | |||
828 | eth_hw_addr_inherit(dev, lowerdev); | 828 | eth_hw_addr_inherit(dev, lowerdev); |
829 | } | 829 | } |
830 | 830 | ||
831 | port->count += 1; | ||
832 | err = register_netdevice(dev); | ||
833 | if (err < 0) | ||
834 | goto destroy_port; | ||
835 | |||
831 | err = netdev_upper_dev_link(lowerdev, dev); | 836 | err = netdev_upper_dev_link(lowerdev, dev); |
832 | if (err) | 837 | if (err) |
833 | goto destroy_port; | 838 | goto destroy_port; |
834 | 839 | ||
835 | port->count += 1; | ||
836 | err = register_netdevice(dev); | ||
837 | if (err < 0) | ||
838 | goto upper_dev_unlink; | ||
839 | 840 | ||
840 | list_add_tail_rcu(&vlan->list, &port->vlans); | 841 | list_add_tail_rcu(&vlan->list, &port->vlans); |
841 | netif_stacked_transfer_operstate(lowerdev, dev); | 842 | netif_stacked_transfer_operstate(lowerdev, dev); |
842 | 843 | ||
843 | return 0; | 844 | return 0; |
844 | 845 | ||
845 | upper_dev_unlink: | ||
846 | netdev_upper_dev_unlink(lowerdev, dev); | ||
847 | destroy_port: | 846 | destroy_port: |
848 | port->count -= 1; | 847 | port->count -= 1; |
849 | if (!port->count) | 848 | if (!port->count) |