The whole read/write semaphore locking can be removed. It doesn't add any
protection that isn't already done by using the RTNL mutex properly.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
{
bond_remove_proc_entry(bond);
bond_create_proc_entry(bond);
{
bond_remove_proc_entry(bond);
bond_create_proc_entry(bond);
- down_write(&(bonding_rwsem));
bond_destroy_sysfs_entry(bond);
bond_create_sysfs_entry(bond);
bond_destroy_sysfs_entry(bond);
bond_create_sysfs_entry(bond);
- up_write(&(bonding_rwsem));
- down_write(&(bonding_rwsem));
slave_dev = dev_get_by_name(&init_net, ifr->ifr_slave);
pr_debug("slave_dev=%p: \n", slave_dev);
slave_dev = dev_get_by_name(&init_net, ifr->ifr_slave);
pr_debug("slave_dev=%p: \n", slave_dev);
- up_write(&(bonding_rwsem));
- down_write(&bonding_rwsem);
-
/* Check to see if the bond already exists. */
if (name) {
list_for_each_entry(bond, &bond_dev_list, bond_list)
/* Check to see if the bond already exists. */
if (name) {
list_for_each_entry(bond, &bond_dev_list, bond_list)
- up_write(&bonding_rwsem);
- rtnl_unlock(); /* allows sysfs registration of net device */
res = bond_create_sysfs_entry(netdev_priv(bond_dev));
if (res < 0)
goto out_unreg;
res = bond_create_sysfs_entry(netdev_priv(bond_dev));
if (res < 0)
goto out_unreg;
- rtnl_lock();
- down_write(&bonding_rwsem);
unregister_netdevice(bond_dev);
out_bond:
bond_deinit(bond_dev);
out_netdev:
free_netdev(bond_dev);
out_rtnl:
unregister_netdevice(bond_dev);
out_bond:
bond_deinit(bond_dev);
out_netdev:
free_netdev(bond_dev);
out_rtnl:
- up_write(&bonding_rwsem);
rtnl_unlock();
return res;
}
rtnl_unlock();
return res;
}
- init_rwsem(&bonding_rwsem);
-
for (i = 0; i < max_bonds; i++) {
res = bond_create(NULL);
if (res)
for (i = 0; i < max_bonds; i++) {
res = bond_create(NULL);
if (res)
/*---------------------------- Declarations -------------------------------*/
static int expected_refcount = -1;
/*---------------------------- Declarations -------------------------------*/
static int expected_refcount = -1;
-/*--------------------------- Data Structures -----------------------------*/
-
-/* Bonding sysfs lock. Why can't we just use the subsystem lock?
- * Because kobject_register tries to acquire the subsystem lock. If
- * we already hold the lock (which we would if the user was creating
- * a new bond through the sysfs interface), we deadlock.
- * This lock is only needed when deleting a bond - we need to make sure
- * that we don't collide with an ongoing ioctl.
- */
-
-struct rw_semaphore bonding_rwsem;
-
-
-
/*------------------------------ Functions --------------------------------*/
/*------------------------------ Functions --------------------------------*/
int res = 0;
struct bonding *bond;
int res = 0;
struct bonding *bond;
- down_read(&(bonding_rwsem));
list_for_each_entry(bond, &bond_dev_list, bond_list) {
if (res > (PAGE_SIZE - IFNAMSIZ)) {
list_for_each_entry(bond, &bond_dev_list, bond_list) {
if (res > (PAGE_SIZE - IFNAMSIZ)) {
}
if (res)
buf[res-1] = '\n'; /* eat the leftover space */
}
if (res)
buf[res-1] = '\n'; /* eat the leftover space */
- up_read(&(bonding_rwsem));
if (command[0] == '-') {
rtnl_lock();
if (command[0] == '-') {
rtnl_lock();
- down_write(&bonding_rwsem);
list_for_each_entry(bond, &bond_dev_list, bond_list)
if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) {
list_for_each_entry(bond, &bond_dev_list, bond_list)
if (strnicmp(bond->dev->name, ifname, IFNAMSIZ) == 0) {
return -EPERM;
out_unlock:
return -EPERM;
out_unlock:
- up_write(&bonding_rwsem);
rtnl_unlock();
/* Always return either count or an error. If you return 0, you'll
rtnl_unlock();
/* Always return either count or an error. If you return 0, you'll
if (!rtnl_trylock())
return restart_syscall();
if (!rtnl_trylock())
return restart_syscall();
- down_write(&(bonding_rwsem));
sscanf(buffer, "%16s", command); /* IFNAMSIZ*/
ifname = command + 1;
sscanf(buffer, "%16s", command); /* IFNAMSIZ*/
ifname = command + 1;
- up_write(&(bonding_rwsem));
rtnl_unlock();
return ret;
}
rtnl_unlock();
return ret;
}
extern const struct bond_parm_tbl fail_over_mac_tbl[];
extern struct bond_parm_tbl ad_select_tbl[];
extern const struct bond_parm_tbl fail_over_mac_tbl[];
extern struct bond_parm_tbl ad_select_tbl[];
-/* exported from bond_sysfs.c */
-extern struct rw_semaphore bonding_rwsem;
-
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
void bond_send_unsolicited_na(struct bonding *bond);
void bond_register_ipv6_notifier(void);
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
void bond_send_unsolicited_na(struct bonding *bond);
void bond_register_ipv6_notifier(void);