[ofa-general] [PATCH v2] ipiob: fix rtnl deadlock

Yossi Etigin yosefe at Voltaire.COM
Wed Aug 6 09:19:22 PDT 2008


This fixes bug #1114 in bugzilla, which is a deadlock between ipoib_stop 
and mcast_join_task.

ipoib_stop is called with rtnl_lock, and flushes ipoib_workqueue.
the flush operation might wait for mcast_join_task to finish, which
in turn might wait for rtnl_lock.

Changes from v1:
Instead of loop-waiting for the lock, give it up if can't lock.
Same thing is done in drivers/net/cxgb3/cxgb3_main.c.

Signed-off-by: Yossi Etigin <yosefe at voltaire.com>

--

Index: b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
===================================================================
--- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2008-08-04 18:09:33.000000000 +0300
+++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	2008-08-06 19:12:19.000000000 +0300
@@ -577,9 +577,11 @@ void ipoib_mcast_join_task(struct work_s
 	priv->mcast_mtu = IPOIB_UD_MTU(ib_mtu_enum_to_int(priv->broadcast->mcmember.mtu));
 
 	if (!ipoib_cm_admin_enabled(dev)) {
-		rtnl_lock();
-		dev_set_mtu(dev, min(priv->mcast_mtu, priv->admin_mtu));
-		rtnl_unlock();
+		/* Avoid deadlock with ipoib_stop */
+		if (rtnl_trylock()) {
+			dev_set_mtu(dev, min(priv->mcast_mtu, priv->admin_mtu));
+			rtnl_unlock();
+		}
 	}
 
 	ipoib_dbg_mcast(priv, "successfully joined all multicast groups\n");

--
--Yossi




More information about the general mailing list