From 6d7ab43ccce5fddeca945ba6b06ba32cda4e3355 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 12 Jun 2009 19:02:49 +0000 Subject: 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 Signed-off-by: David S. Miller --- drivers/net/bonding/bond_sysfs.c | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'drivers/net/bonding') diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index ecb20208f67..e3fb7f51515 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c @@ -40,12 +40,6 @@ #define to_dev(obj) container_of(obj, struct device, kobj) #define to_bond(cd) ((struct bonding *)(netdev_priv(to_net_dev(cd)))) -/*---------------------------- Declarations -------------------------------*/ - -static int expected_refcount = -1; - -/*------------------------------ Functions --------------------------------*/ - /* * "show" function for the bond_masters attribute. * The class parameter is ignored. @@ -112,18 +106,6 @@ static ssize_t bonding_store_bonds(struct class *cls, list_for_each_entry(bond, &bond_dev_list, bond_list) if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) { - /* check the ref count on the bond's kobject. - * If it's > expected, then there's a file open, - * and we have to fail. - */ - if (atomic_read(&bond->dev->dev.kobj.kref.refcount) - > expected_refcount){ - pr_info(DRV_NAME - ": Unable remove bond %s due to open references.\n", - ifname); - res = -EPERM; - goto out_unlock; - } pr_info(DRV_NAME ": %s is being deleted...\n", bond->dev->name); @@ -1579,9 +1561,6 @@ int bond_create_sysfs_entry(struct bonding *bond) if (err) printk(KERN_EMERG "eek! didn't create group!\n"); - if (expected_refcount < 1) - expected_refcount = atomic_read(&bond->dev->dev.kobj.kref.refcount); - return err; } /* -- cgit v1.2.3-18-g5258