Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 195711
b: refs/heads/master
c: 34ce27b
h: refs/heads/master
i:
  195709: 134bbf1
  195707: 1c53593
  195703: 5c33aee
  195695: 763a1de
  195679: 65f543b
  195647: c8d577c
  195583: 32a9275
v: v3
  • Loading branch information
Vasu Dev authored and James Bottomley committed May 17, 2010
1 parent 3c842ac commit ddded08
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7b2787ec15b9d1c2f716da61b0eec21a3f5e6520
refs/heads/master: 34ce27bcf96f5f366e1fa8c4729ffc8a55de4cc3
41 changes: 34 additions & 7 deletions trunk/drivers/scsi/fcoe/fcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,12 @@ static inline int fcoe_em_config(struct fc_lport *lport)
/**
* fcoe_if_destroy() - Tear down a SW FCoE instance
* @lport: The local port to be destroyed
*
* Locking: must be called with the RTNL mutex held and RTNL mutex
* needed to be dropped by this function since not dropping RTNL
* would cause circular locking warning on synchronous fip worker
* cancelling thru fcoe_interface_put invoked by this function.
*
*/
static void fcoe_if_destroy(struct fc_lport *lport)
{
Expand All @@ -823,7 +829,6 @@ static void fcoe_if_destroy(struct fc_lport *lport)
/* Free existing transmit skbs */
fcoe_clean_pending_queue(lport);

rtnl_lock();
if (!is_zero_ether_addr(port->data_src_addr))
dev_unicast_delete(netdev, port->data_src_addr);
rtnl_unlock();
Expand Down Expand Up @@ -1902,7 +1907,12 @@ static int fcoe_disable(const char *buffer, struct kernel_param *kp)
goto out_nodev;
}

rtnl_lock();
if (!rtnl_trylock()) {
dev_put(netdev);
mutex_unlock(&fcoe_config_mutex);
return restart_syscall();
}

fcoe = fcoe_hostlist_lookup_port(netdev);
rtnl_unlock();

Expand Down Expand Up @@ -1952,7 +1962,12 @@ static int fcoe_enable(const char *buffer, struct kernel_param *kp)
goto out_nodev;
}

rtnl_lock();
if (!rtnl_trylock()) {
dev_put(netdev);
mutex_unlock(&fcoe_config_mutex);
return restart_syscall();
}

fcoe = fcoe_hostlist_lookup_port(netdev);
rtnl_unlock();

Expand Down Expand Up @@ -2003,7 +2018,12 @@ static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
goto out_nodev;
}

rtnl_lock();
if (!rtnl_trylock()) {
dev_put(netdev);
mutex_unlock(&fcoe_config_mutex);
return restart_syscall();
}

fcoe = fcoe_hostlist_lookup_port(netdev);
if (!fcoe) {
rtnl_unlock();
Expand All @@ -2012,7 +2032,7 @@ static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
}
list_del(&fcoe->list);
fcoe_interface_cleanup(fcoe);
rtnl_unlock();
/* RTNL mutex is dropped by fcoe_if_destroy */
fcoe_if_destroy(fcoe->ctlr.lp);
module_put(THIS_MODULE);

Expand All @@ -2033,6 +2053,8 @@ static void fcoe_destroy_work(struct work_struct *work)

port = container_of(work, struct fcoe_port, destroy_work);
mutex_lock(&fcoe_config_mutex);
rtnl_lock();
/* RTNL mutex is dropped by fcoe_if_destroy */
fcoe_if_destroy(port->lport);
mutex_unlock(&fcoe_config_mutex);
}
Expand All @@ -2054,6 +2076,12 @@ static int fcoe_create(const char *buffer, struct kernel_param *kp)
struct net_device *netdev;

mutex_lock(&fcoe_config_mutex);

if (!rtnl_trylock()) {
mutex_unlock(&fcoe_config_mutex);
return restart_syscall();
}

#ifdef CONFIG_FCOE_MODULE
/*
* Make sure the module has been initialized, and is not about to be
Expand All @@ -2071,7 +2099,6 @@ static int fcoe_create(const char *buffer, struct kernel_param *kp)
goto out_nomod;
}

rtnl_lock();
netdev = fcoe_if_to_netdev(buffer);
if (!netdev) {
rc = -ENODEV;
Expand Down Expand Up @@ -2126,9 +2153,9 @@ static int fcoe_create(const char *buffer, struct kernel_param *kp)
out_putdev:
dev_put(netdev);
out_nodev:
rtnl_unlock();
module_put(THIS_MODULE);
out_nomod:
rtnl_unlock();
mutex_unlock(&fcoe_config_mutex);
return rc;
}
Expand Down

0 comments on commit ddded08

Please sign in to comment.