Revert "IPoIB: Make ipoib_mcast_stop_thread flush the workqueue"
authorRoland Dreier <roland@purestorage.com>
Fri, 30 Jan 2015 23:38:46 +0000 (15:38 -0800)
committerRoland Dreier <roland@purestorage.com>
Fri, 30 Jan 2015 23:38:46 +0000 (15:38 -0800)
This reverts commit bb42a6dd02fb2901a69dbec2358810735b14b186.

The series of IPoIB bug fixes that went into 3.19-rc1 introduce
regressions, and after trying to sort things out, we decided to revert
to 3.18's IPoIB driver and get things right for 3.20.

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

index 28dc927..45fd10a 100644 (file)
@@ -499,7 +499,7 @@ void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb);
 
 void ipoib_mcast_restart_task(struct work_struct *work);
 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 6609678..bfd17d4 100644 (file)
@@ -747,7 +747,7 @@ int ipoib_ib_dev_down(struct net_device *dev, int flush)
        clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags);
        netif_carrier_off(dev);
 
-       ipoib_mcast_stop_thread(dev);
+       ipoib_mcast_stop_thread(dev, flush);
        ipoib_mcast_dev_flush(dev);
 
        ipoib_flush_paths(dev);
@@ -1097,7 +1097,7 @@ void ipoib_ib_dev_cleanup(struct net_device *dev)
         */
        ipoib_flush_paths(dev);
 
-       ipoib_mcast_stop_thread(dev);
+       ipoib_mcast_stop_thread(dev, 1);
        ipoib_mcast_dev_flush(dev);
 
        ipoib_transport_dev_cleanup(dev);
index bc50dd0..845f910 100644 (file)
@@ -648,7 +648,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);
 
@@ -659,7 +659,8 @@ int ipoib_mcast_stop_thread(struct net_device *dev)
        cancel_delayed_work(&priv->mcast_task);
        mutex_unlock(&mcast_mutex);
 
-       flush_workqueue(priv->wq);
+       if (flush)
+               flush_workqueue(priv->wq);
 
        return 0;
 }
@@ -837,6 +838,8 @@ void ipoib_mcast_restart_task(struct work_struct *work)
 
        ipoib_dbg_mcast(priv, "restarting multicast task\n");
 
+       ipoib_mcast_stop_thread(dev, 0);
+
        local_irq_save(flags);
        netif_addr_lock(dev);
        spin_lock(&priv->lock);
@@ -933,10 +936,13 @@ void ipoib_mcast_restart_task(struct work_struct *work)
         * We have to cancel outside of the spinlock, but we have to
         * take the rtnl lock or else we race with the removal of
         * entries from the remove list in mcast_dev_flush as part
-        * of ipoib_stop().  We detect the drop of the ADMIN_UP flag
-        * to signal that we have hit this particular race, and we
-        * return since we know we don't need to do anything else
-        * anyway.
+        * of ipoib_stop() which will call mcast_stop_thread with
+        * flush == 1 while holding the rtnl lock, and the
+        * flush_workqueue won't complete until this restart_mcast_task
+        * completes.  So do like the carrier on task and attempt to
+        * take the rtnl lock, but if we can't before the ADMIN_UP flag
+        * goes away, then just return and know that the remove list will
+        * get flushed later by mcast_stop_thread.
         */
        while (!rtnl_trylock()) {
                if (!test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
@@ -948,9 +954,6 @@ void ipoib_mcast_restart_task(struct work_struct *work)
                ipoib_mcast_leave(mcast->dev, mcast);
                ipoib_mcast_free(mcast);
        }
-       /*
-        * Restart our join task if needed
-        */
        ipoib_mcast_start_thread(dev);
        rtnl_unlock();
 }