[openib-general] [PATCH] MAD thread doesn't get killed on failure to open port

Krishna Kumar krkumar at us.ibm.com
Mon Oct 18 13:11:19 PDT 2004


This patch should fix above problem, as well as get rid of redundant
initialization code.

Thanks,

- KK

--- ib_mad.c.org	2004-10-18 12:42:18.000000000 -0700
+++ ib_mad.c	2004-10-18 12:44:20.000000000 -0700
@@ -1676,9 +1676,6 @@ static int ib_mad_port_open(struct ib_de
 	port_priv->device = device;
 	port_priv->port_num = port_num;
 	spin_lock_init(&port_priv->reg_lock);
-	for (i = 0; i < MAX_MGMT_VERSION; i++) {
-		port_priv->version[i] = NULL;
-	}

 	cq_size = (IB_MAD_QP_SEND_SIZE + IB_MAD_QP_RECV_SIZE) * 2;
 	port_priv->cq = ib_create_cq(port_priv->device,
@@ -1737,12 +1734,8 @@ static int ib_mad_port_open(struct ib_de
 	spin_lock_init(&port_priv->send_list_lock);
 	INIT_LIST_HEAD(&port_priv->agent_list);
 	INIT_LIST_HEAD(&port_priv->send_posted_mad_list);
-	port_priv->send_posted_mad_count = 0;
-	for (i = 0; i < IB_MAD_QPS_CORE; i++) {
+	for (i = 0; i < IB_MAD_QPS_CORE; i++)
 		INIT_LIST_HEAD(&port_priv->recv_posted_mad_list[i]);
-		port_priv->recv_posted_mad_count[i] = 0;
-		port_priv->recv_wr_index[i] = 0;
-	}

 	ret = ib_mad_thread_init(port_priv);
 	if (ret)
@@ -1751,7 +1744,7 @@ static int ib_mad_port_open(struct ib_de
 	ret = ib_mad_port_start(port_priv);
 	if (ret) {
 		printk(KERN_ERR PFX "Couldn't start port\n");
-		goto error8;
+		goto error9;
 	}

 	spin_lock_irqsave(&ib_mad_port_list_lock, flags);
@@ -1760,6 +1753,8 @@ static int ib_mad_port_open(struct ib_de

 	return 0;

+error9:
+	kthread_stop(port_priv->mad_thread);
 error8:
 	ib_destroy_qp(port_priv->qp[1]);
 error7:




More information about the general mailing list