aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_sysfs.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-06-12 15:02:49 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-14 02:29:00 -0400
commit6d7ab43ccce5fddeca945ba6b06ba32cda4e3355 (patch)
tree7492faab7570a039535936d4822f0c69f2eee0be /drivers/net/bonding/bond_sysfs.c
parent3d632c3f28e69f0d6d44aa09c4df708d63a91a7c (diff)
bonding: elminate bad refcount code
The "expected_refcount" stuff in bonding sysfs module is a mistake. Sysfs does proper refcounting, and it is okay to remove a bond device that has some user process holding the file open. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r--drivers/net/bonding/bond_sysfs.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index ecb20208f67c..e3fb7f515150 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -40,12 +40,6 @@
40#define to_dev(obj) container_of(obj, struct device, kobj) 40#define to_dev(obj) container_of(obj, struct device, kobj)
41#define to_bond(cd) ((struct bonding *)(netdev_priv(to_net_dev(cd)))) 41#define to_bond(cd) ((struct bonding *)(netdev_priv(to_net_dev(cd))))
42 42
43/*---------------------------- Declarations -------------------------------*/
44
45static int expected_refcount = -1;
46
47/*------------------------------ Functions --------------------------------*/
48
49/* 43/*
50 * "show" function for the bond_masters attribute. 44 * "show" function for the bond_masters attribute.
51 * The class parameter is ignored. 45 * The class parameter is ignored.
@@ -112,18 +106,6 @@ static ssize_t bonding_store_bonds(struct class *cls,
112 106
113 list_for_each_entry(bond, &bond_dev_list, bond_list) 107 list_for_each_entry(bond, &bond_dev_list, bond_list)
114 if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) { 108 if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) {
115 /* check the ref count on the bond's kobject.
116 * If it's > expected, then there's a file open,
117 * and we have to fail.
118 */
119 if (atomic_read(&bond->dev->dev.kobj.kref.refcount)
120 > expected_refcount){
121 pr_info(DRV_NAME
122 ": Unable remove bond %s due to open references.\n",
123 ifname);
124 res = -EPERM;
125 goto out_unlock;
126 }
127 pr_info(DRV_NAME 109 pr_info(DRV_NAME
128 ": %s is being deleted...\n", 110 ": %s is being deleted...\n",
129 bond->dev->name); 111 bond->dev->name);
@@ -1579,9 +1561,6 @@ int bond_create_sysfs_entry(struct bonding *bond)
1579 if (err) 1561 if (err)
1580 printk(KERN_EMERG "eek! didn't create group!\n"); 1562 printk(KERN_EMERG "eek! didn't create group!\n");
1581 1563
1582 if (expected_refcount < 1)
1583 expected_refcount = atomic_read(&bond->dev->dev.kobj.kref.refcount);
1584
1585 return err; 1564 return err;
1586} 1565}
1587/* 1566/*