[openib-general] [PATCH]deadlock problem in ipoib

Shirley Ma xma at us.ibm.com
Thu Feb 17 16:28:47 PST 2005


Sorry, made a mistake in the previous patch. Here is the right one.

diff -urN infiniband/ulp/ipoib/ipoib_main.c 
infiniband-lock/ulp/ipoib/ipoib_main.c
--- infiniband/ulp/ipoib/ipoib_main.c   2005-02-17 17:24:56.000000000 
+0000
+++ infiniband-lock/ulp/ipoib/ipoib_main.c      2005-02-18 
00:20:10.000000000 +0000
@@ -220,18 +220,23 @@
        struct ipoib_dev_priv *priv = netdev_priv(dev);
        struct ipoib_neigh *neigh, *tn;
        struct sk_buff *skb;
+       LIST_HEAD(ah_list);
+       struct ipoib_ah *ah, *tah;
 
        while ((skb = __skb_dequeue(&path->queue)))
                dev_kfree_skb_irq(skb);
 
        list_for_each_entry_safe(neigh, tn, &path->neigh_list, list) {
                if (neigh->ah)
-                       ipoib_put_ah(neigh->ah);
+                       list_add_tail(&neigh->ah->list, &ah_list);
                *to_ipoib_neigh(neigh->neighbour) = NULL;
                neigh->neighbour->ops->destructor = NULL;
                kfree(neigh);
        }
 
+       list_for_each_entry_safe(ah, tah, &ah_list, list)
+               ipoib_put_ah(ah);
+
        if (path->ah)
                ipoib_put_ah(path->ah);
 
@@ -660,6 +665,7 @@
        struct ipoib_neigh *neigh = *to_ipoib_neigh(n);
        struct ipoib_dev_priv *priv = netdev_priv(n->dev);
        unsigned long flags;
+       struct ipoib_ah *ah = NULL;
 
        ipoib_dbg(priv,
                  "neigh_destructor for %06x " IPOIB_GID_FMT "\n",
@@ -670,13 +676,16 @@
 
        if (neigh) {
                if (neigh->ah)
-                       ipoib_put_ah(neigh->ah);
+                       ah = neigh->ah;
                list_del(&neigh->list);
                *to_ipoib_neigh(n) = NULL;
                kfree(neigh);
        }
 
        spin_unlock_irqrestore(&priv->lock, flags);
+ 
+       if (ah)
+               ipoib_put_ah(ah);
 }
 
 static int ipoib_neigh_setup(struct neighbour *neigh)
diff -urN infiniband/ulp/ipoib/ipoib_multicast.c 
infiniband-lock/ulp/ipoib/ipoib_multicast.c
--- infiniband/ulp/ipoib/ipoib_multicast.c      2005-02-17 
17:24:56.000000000 +0000
+++ infiniband-lock/ulp/ipoib/ipoib_multicast.c 2005-02-18 
00:20:34.000000000 +0000
@@ -93,6 +93,8 @@
        struct ipoib_dev_priv *priv = netdev_priv(dev);
        struct ipoib_neigh *neigh, *tmp;
        unsigned long flags;
+       LIST_HEAD(ah_list);
+       struct ipoib_ah *ah, *tah;
 
        ipoib_dbg_mcast(netdev_priv(dev),
                        "deleting multicast group " IPOIB_GID_FMT "\n",
@@ -101,7 +103,8 @@
        spin_lock_irqsave(&priv->lock, flags);
 
        list_for_each_entry_safe(neigh, tmp, &mcast->neigh_list, list) {
-               ipoib_put_ah(neigh->ah);
+               if (neigh->ah)
+                       list_add_tail(&neigh->ah->list, &ah_list);
                *to_ipoib_neigh(neigh->neighbour) = NULL;
                neigh->neighbour->ops->destructor = NULL;
                kfree(neigh);
@@ -109,6 +112,9 @@
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
+       list_for_each_entry_safe(ah, tah, &ah_list, list)
+               ipoib_put_ah(ah);
+
        if (mcast->ah)
                ipoib_put_ah(mcast->ah);
 





Thanks
Shirley Ma
IBM Linux Technology Center
15300 SW Koll Parkway
Beaverton, OR 97006-6063
Phone(Fax): (503) 578-7638

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050217/26bbff88/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: infiniband-lock.patch
Type: application/octet-stream
Size: 2506 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050217/26bbff88/attachment.obj>


More information about the general mailing list