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

Shirley Ma xma at us.ibm.com
Mon Feb 14 15:16:32 PST 2005


Roland, 

Please review this patch.

This patch has fixed a deadlock problem: the caller calls ipoib_put_ah() 
while holding priv->lock. (In ipoib_free_ah() the same lock is 
reacquired.) This also fixes the ipoib_flush_paths() calls __patch_free() 
without holding priv->lock.

My email has problem to inline patches. So I inline this patch for review 
and an attached file for applying this patch. Sorry for the inconvenient.

diff -urN infiniband/ulp/ipoib/ipoib_ib.c 
infiniband-panic/ulp/ipoib/ipoib_ib.c
--- infiniband/ulp/ipoib/ipoib_ib.c     2005-02-09 10:45:06.000000000 
-0800
+++ infiniband-panic/ulp/ipoib/ipoib_ib.c       2005-02-14 
14:52:43.000000000 -0800
@@ -85,11 +85,8 @@
                ipoib_dbg(priv, "Freeing ah %p\n", ah->ah);
                ib_destroy_ah(ah->ah);
                kfree(ah);
-       } else {
-               spin_lock_irqsave(&priv->lock, flags);
+       } else
                list_add_tail(&ah->list, &priv->dead_ahs);
-               spin_unlock_irqrestore(&priv->lock, flags);
-       }
 }
 
 static inline int ipoib_ib_receive(struct ipoib_dev_priv *priv,
diff -urN infiniband/ulp/ipoib/ipoib_main.c 
infiniband-panic/ulp/ipoib/ipoib_main.c
--- infiniband/ulp/ipoib/ipoib_main.c   2005-02-04 16:05:13.000000000 
-0800
+++ infiniband-panic/ulp/ipoib/ipoib_main.c     2005-02-11 
15:00:33.000000000 -0800
@@ -256,7 +256,9 @@
                if (path->query)
                        ib_sa_cancel_query(path->query_id, path->query);
                wait_for_completion(&path->done);
+               spin_lock_irqsave(&priv->lock, flags);
                __path_free(dev, path);
+               spin_unlock_irqrestore(&priv->lock, flags);
        }
 }
 
diff -urN infiniband/ulp/ipoib/ipoib_multicast.c 
infiniband-panic/ulp/ipoib/ipoib_multicast.c
--- infiniband/ulp/ipoib/ipoib_multicast.c      2005-02-04 
16:05:13.000000000 -0800
+++ infiniband-panic/ulp/ipoib/ipoib_multicast.c        2005-02-14 
14:54:52.000000000 -0800
@@ -107,11 +107,11 @@
                kfree(neigh);
        }
 
-       spin_unlock_irqrestore(&priv->lock, flags);
-
        if (mcast->ah)
                ipoib_put_ah(mcast->ah);
 
+       spin_unlock_irqrestore(&priv->lock, flags);
+
        while (!skb_queue_empty(&mcast->pkt_queue)) {
                struct sk_buff *skb = skb_dequeue(&mcast->pkt_queue);


 

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/20050214/405f1800/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: infiniband-lock.patch
Type: application/octet-stream
Size: 1611 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050214/405f1800/attachment.obj>


More information about the general mailing list