diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-12 05:22:02 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-12 05:22:02 -0400 |
commit | 4bb073c0e32a0862bdb5215d11af19f6c0180c98 (patch) | |
tree | 009d95592e3813346c75129bb19d140d393ca913 /drivers/net/ehea | |
parent | 7afb380db43ed137b7f67e0e3c3e5afd1ecde730 (diff) |
net: Eliminate flush_scheduled_work() calls while RTNL is held.
If the RTNL is held when we invoke flush_scheduled_work() we could
deadlock. One such case is linkwatch, it is a work struct which tries
to grab the RTNL semaphore.
The most common case are net driver ->stop() methods. The
simplest conversion is to instead use cancel_{delayed_}work_sync()
explicitly on the various work struct the driver uses.
This is an OK transformation because these work structs are doing
things like resetting the chip, restarting link negotiation, and so
forth. And if we're bringing down the device, we're about to turn the
chip off and reset it anways. So if we cancel a pending work event,
that's fine here.
Some drivers were working around this deadlock by using a msleep()
polling loop of some sort, and those cases are converted to instead
use cancel_{delayed_}work_sync() as well.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ehea')
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index faae01dc1c4b..075fd547421e 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -2605,7 +2605,8 @@ static int ehea_stop(struct net_device *dev) | |||
2605 | if (netif_msg_ifdown(port)) | 2605 | if (netif_msg_ifdown(port)) |
2606 | ehea_info("disabling port %s", dev->name); | 2606 | ehea_info("disabling port %s", dev->name); |
2607 | 2607 | ||
2608 | flush_scheduled_work(); | 2608 | cancel_work_sync(&port->reset_task); |
2609 | |||
2609 | mutex_lock(&port->port_lock); | 2610 | mutex_lock(&port->port_lock); |
2610 | netif_stop_queue(dev); | 2611 | netif_stop_queue(dev); |
2611 | port_napi_disable(port); | 2612 | port_napi_disable(port); |