[ewg] IB/ipoib: Fix CM connection premature destruction

Eli Cohen eli at dev.mellanox.co.il
Thu May 29 05:15:18 PDT 2008


>From 24e88d727dbbb7fd491edb57416f5cb0d4009f1d Mon Sep 17 00:00:00 2001
From: Eli Cohen <eli at mellanox.co.il>
Date: Thu, 29 May 2008 15:13:25 +0300
Subject: [PATCH] IB/ipoib: Fix CM connection premature destruction

Destroy the CM connection at ipoib_cm_tx_destroy() after the TX
queue is flushed. Failure to do so might cause the cm_id to be
allocated again pending TX completions which have not been reported
yet will move the connection to the reap list again causing it to
be destroyed before it has been used. The overall effect would be
to delay the creation of a new connection.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
 drivers/infiniband/ulp/ipoib/ipoib_cm.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 819c027..a40e649 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -1113,9 +1113,6 @@ static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)
 	ipoib_dbg(priv, "Destroy active connection 0x%x head 0x%x tail 0x%x\n",
 		  p->qp ? p->qp->qp_num : 0, p->tx_head, p->tx_tail);
 
-	if (p->id)
-		ib_destroy_cm_id(p->id);
-
 	if (p->tx_ring) {
 		/* Wait for all sends to complete */
 		begin = jiffies;
@@ -1131,6 +1128,8 @@ static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p)
 	}
 
 timeout:
+	if (p->id)
+		ib_destroy_cm_id(p->id);
 
 	while ((int) p->tx_tail - (int) p->tx_head < 0) {
 		tx_req = &p->tx_ring[p->tx_tail & (ipoib_sendq_size - 1)];
-- 
1.5.5.1






More information about the ewg mailing list