]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/net/bonding/bond_sysfs.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
[mirror_ubuntu-bionic-kernel.git] / drivers / net / bonding / bond_sysfs.c
index 0e610aa1fdf916937a7955fb0c141514bd088f5f..878f7aabeeac2b1a27324e3a2a89bef0371343c4 100644 (file)
@@ -1433,6 +1433,21 @@ int bond_create_sysfs(void)
                return -ENODEV;
 
        ret = class_create_file(netdev_class, &class_attr_bonding_masters);
+       /*
+        * Permit multiple loads of the module by ignoring failures to
+        * create the bonding_masters sysfs file.  Bonding devices
+        * created by second or subsequent loads of the module will
+        * not be listed in, or controllable by, bonding_masters, but
+        * will have the usual "bonding" sysfs directory.
+        *
+        * This is done to preserve backwards compatibility for
+        * initscripts/sysconfig, which load bonding multiple times to
+        * configure multiple bonding devices.
+        */
+       if (ret == -EEXIST) {
+               netdev_class = NULL;
+               return 0;
+       }
 
        return ret;