aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/net-sysfs.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2010-05-04 20:36:49 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-21 12:37:34 -0400
commita1b3f594dc5faab91d3a218c7019e9b5edd9fe1a (patch)
tree42c81d7a89330afc65c11392e181e1a30f277f43 /net/core/net-sysfs.c
parent417daa1e8f893fbac88fd395340ba7779fd3926c (diff)
net: Expose all network devices in a namespaces in sysfs
This reverts commit aaf8cdc34ddba08122f02217d9d684e2f9f5d575. Drivers like the ipw2100 call device_create_group when they are initialized and device_remove_group when they are shutdown. Moving them between namespaces deletes their sysfs groups early. In particular the following call chain results. netdev_unregister_kobject -> device_del -> kobject_del -> sysfs_remove_dir With sysfs_remove_dir recursively deleting all of it's subdirectories, and nothing adding them back. Ouch! Therefore we need to call something that ultimate calls sysfs_mv_dir as that sysfs function can move sysfs directories between namespaces without deleting their subdirectories or their contents. Allowing us to avoid placing extra boiler plate into every driver that does something interesting with sysfs. Currently the function that provides that capability is device_rename. That is the code works without nasty side effects as originally written. So remove the misguided fix for moving devices between namespaces. The bug in the kobject layer that inspired it has now been recognized and fixed. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net/core/net-sysfs.c')
-rw-r--r--net/core/net-sysfs.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 6881e65944c..99e7052d732 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -808,9 +808,6 @@ static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)
808 struct net_device *dev = to_net_dev(d); 808 struct net_device *dev = to_net_dev(d);
809 int retval; 809 int retval;
810 810
811 if (!net_eq(dev_net(dev), &init_net))
812 return 0;
813
814 /* pass interface to uevent. */ 811 /* pass interface to uevent. */
815 retval = add_uevent_var(env, "INTERFACE=%s", dev->name); 812 retval = add_uevent_var(env, "INTERFACE=%s", dev->name);
816 if (retval) 813 if (retval)
@@ -869,9 +866,6 @@ void netdev_unregister_kobject(struct net_device * net)
869 866
870 kobject_get(&dev->kobj); 867 kobject_get(&dev->kobj);
871 868
872 if (!net_eq(dev_net(net), &init_net))
873 return;
874
875#ifdef CONFIG_RPS 869#ifdef CONFIG_RPS
876 rx_queue_remove_kobjects(net); 870 rx_queue_remove_kobjects(net);
877#endif 871#endif
@@ -886,6 +880,7 @@ int netdev_register_kobject(struct net_device *net)
886 const struct attribute_group **groups = net->sysfs_groups; 880 const struct attribute_group **groups = net->sysfs_groups;
887 int error = 0; 881 int error = 0;
888 882
883 device_initialize(dev);
889 dev->class = &net_class; 884 dev->class = &net_class;
890 dev->platform_data = net; 885 dev->platform_data = net;
891 dev->groups = groups; 886 dev->groups = groups;
@@ -908,9 +903,6 @@ int netdev_register_kobject(struct net_device *net)
908#endif 903#endif
909#endif /* CONFIG_SYSFS */ 904#endif /* CONFIG_SYSFS */
910 905
911 if (!net_eq(dev_net(net), &init_net))
912 return 0;
913
914 error = device_add(dev); 906 error = device_add(dev);
915 if (error) 907 if (error)
916 return error; 908 return error;
@@ -939,12 +931,6 @@ void netdev_class_remove_file(struct class_attribute *class_attr)
939EXPORT_SYMBOL(netdev_class_create_file); 931EXPORT_SYMBOL(netdev_class_create_file);
940EXPORT_SYMBOL(netdev_class_remove_file); 932EXPORT_SYMBOL(netdev_class_remove_file);
941 933
942void netdev_initialize_kobject(struct net_device *net)
943{
944 struct device *device = &(net->dev);
945 device_initialize(device);
946}
947
948int netdev_kobject_init(void) 934int netdev_kobject_init(void)
949{ 935{
950 kobj_ns_type_register(&net_ns_type_operations); 936 kobj_ns_type_register(&net_ns_type_operations);