All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Jay Vosburg <fubar@us.ibm.com>, "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, bonding-devel@lists.sourceforge.net
Subject: [PATCH 6/9] bonding: elminate bad refcount code
Date: Fri, 12 Jun 2009 22:02:49 -0700	[thread overview]
Message-ID: <20090613050422.014974866@vyatta.com> (raw)
In-Reply-To: 20090613050243.100086546@vyatta.com

[-- Attachment #1: bond-refcount.patch --]
[-- Type: text/plain, Size: 1742 bytes --]

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>


--- a/drivers/net/bonding/bond_sysfs.c	2009-06-12 21:46:22.183394245 -0700
+++ b/drivers/net/bonding/bond_sysfs.c	2009-06-12 21:46:34.113395362 -0700
@@ -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(struc
 
 		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 bondi
 	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;
 }
 /*

-- 


  parent reply	other threads:[~2009-06-13  5:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-13  5:02 [PATCH 0/9] Bonding patches for 2.6.31 Stephen Hemminger
2009-06-13  5:02 ` [PATCH 1/9] bonding: bond_create always called with default parameters Stephen Hemminger
2009-06-13  5:02 ` [PATCH 2/9] bonding: initialize before registration Stephen Hemminger
2009-06-13  5:02 ` [PATCH 3/9] Subjec: bonding: remove bonding read/write semaphore Stephen Hemminger
2009-06-13  5:02 ` [PATCH 4/9] bonding: fix destructor Stephen Hemminger
2009-06-13  5:02 ` [PATCH 5/9] bonding: fix style issues Stephen Hemminger
2009-06-13  5:02 ` Stephen Hemminger [this message]
2009-06-13  5:02 ` [PATCH 7/9] bonding: network device names are case sensative Stephen Hemminger
2009-06-13  5:02 ` [PATCH 8/9] bonding: use is_zero_ether_addr Stephen Hemminger
2009-06-13  5:02 ` [PATCH 9/9] bonding: initialization rework Stephen Hemminger
2009-06-14  6:37 ` [PATCH 0/9] Bonding patches for 2.6.31 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090613050422.014974866@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=bonding-devel@lists.sourceforge.net \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.