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

Shirley Ma xma at us.ibm.com
Thu Feb 24 10:13:04 PST 2005


Here is the patch against the most recent bit. Please review it. 

Signed-off-by: Shirley Ma <xma at us.ibm.com> 

diff -urpN infiniband/ulp/ipoib/ipoib_main.c 
infiniband-spinlock/ulp/ipoib/ipoib_main.c
--- infiniband/ulp/ipoib/ipoib_main.c   2005-02-24 18:06:15.000000000 
+0000
+++ infiniband-spinlock/ulp/ipoib/ipoib_main.c  2005-02-24 
18:12:13.000000000 +0000
@@ -220,18 +220,23 @@ static void __path_free(struct net_devic
        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 @@ static void ipoib_neigh_destructor(struc
        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 @@ static void ipoib_neigh_destructor(struc
 
        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 -urpN infiniband/ulp/ipoib/ipoib_multicast.c 
infiniband-spinlock/ulp/ipoib/ipoib_multicast.c
--- infiniband/ulp/ipoib/ipoib_multicast.c      2005-02-24 
18:06:15.000000000 +0000
+++ infiniband-spinlock/ulp/ipoib/ipoib_multicast.c     2005-02-24 
18:12:13.000000000 +0000
@@ -93,6 +93,8 @@ static void ipoib_mcast_free(struct ipoi
        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 @@ static void ipoib_mcast_free(struct ipoi
        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 @@ static void ipoib_mcast_free(struct ipoi
 
        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/20050224/908b496b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: infiniband-spinlock.patch
Type: application/octet-stream
Size: 2770 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050224/908b496b/attachment.obj>


More information about the general mailing list