[PATCH] IPoIB: Don't flush workqueue from within workqueue
authorRoland Dreier <rolandd@cisco.com>
Tue, 20 Sep 2005 17:52:04 +0000 (10:52 -0700)
committerRoland Dreier <rolandd@cisco.com>
Tue, 20 Sep 2005 17:52:04 +0000 (10:52 -0700)
ipoib_mcast_restart_task() is always called from within the
single-threaded IPoIB workqueue, so flushing the workqueue from within
the function can lead to a recursion overflow.  But since we're
running in a single-threaded workqueue, we're already synchronized
against other items in the workqueue, so just get rid of the flush in
ipoib_mcast_restart_task().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/ipoib/ipoib.h
drivers/infiniband/ulp/ipoib/ipoib_ib.c
drivers/infiniband/ulp/ipoib/ipoib_multicast.c

index bea960b8191feffff376dd7b64a26c2d9586d6f6..4ea1c1ca85bc965fa330d6b1a9e24161457fa817 100644 (file)
@@ -257,7 +257,7 @@ void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid,
 
 void ipoib_mcast_restart_task(void *dev_ptr);
 int ipoib_mcast_start_thread(struct net_device *dev);
-int ipoib_mcast_stop_thread(struct net_device *dev);
+int ipoib_mcast_stop_thread(struct net_device *dev, int flush);
 
 void ipoib_mcast_dev_down(struct net_device *dev);
 void ipoib_mcast_dev_flush(struct net_device *dev);
index ef0e3894863c023c08082c4c201da070fb393871..f7440096b5ed0355a41252c50c93f5290b1810df 100644 (file)
@@ -432,7 +432,7 @@ int ipoib_ib_dev_down(struct net_device *dev)
                flush_workqueue(ipoib_workqueue);
        }
 
-       ipoib_mcast_stop_thread(dev);
+       ipoib_mcast_stop_thread(dev, 1);
 
        /*
         * Flush the multicast groups first so we stop any multicast joins. The
@@ -599,7 +599,7 @@ void ipoib_ib_dev_cleanup(struct net_device *dev)
 
        ipoib_dbg(priv, "cleaning up ib_dev\n");
 
-       ipoib_mcast_stop_thread(dev);
+       ipoib_mcast_stop_thread(dev, 1);
 
        /* Delete the broadcast address and the local address */
        ipoib_mcast_dev_down(dev);
index 3aab4d85abfc67575d210a22c41d81195dd978c2..36ce29836bf2fd218e6d37e0cb2e580e5fa94085 100644 (file)
@@ -598,7 +598,7 @@ int ipoib_mcast_start_thread(struct net_device *dev)
        return 0;
 }
 
-int ipoib_mcast_stop_thread(struct net_device *dev)
+int ipoib_mcast_stop_thread(struct net_device *dev, int flush)
 {
        struct ipoib_dev_priv *priv = netdev_priv(dev);
        struct ipoib_mcast *mcast;
@@ -610,7 +610,8 @@ int ipoib_mcast_stop_thread(struct net_device *dev)
        cancel_delayed_work(&priv->mcast_task);
        up(&mcast_mutex);
 
-       flush_workqueue(ipoib_workqueue);
+       if (flush)
+               flush_workqueue(ipoib_workqueue);
 
        if (priv->broadcast && priv->broadcast->query) {
                ib_sa_cancel_query(priv->broadcast->query_id, priv->broadcast->query);
@@ -832,7 +833,7 @@ void ipoib_mcast_restart_task(void *dev_ptr)
 
        ipoib_dbg_mcast(priv, "restarting multicast task\n");
 
-       ipoib_mcast_stop_thread(dev);
+       ipoib_mcast_stop_thread(dev, 0);
 
        spin_lock_irqsave(&priv->lock, flags);