[openib-general] [PATCH] IB_CM: Limit the MRA timeout

Ishai Rabinovitz ishai at mellanox.co.il
Tue Oct 3 14:19:21 PDT 2006


There is a bug in SRP Engenio target that send a large value as service
timeout. (It gets 30 which mean timeout of (2^(30-8))=4195 sec.)
Such a long timeout is not reasonable and it may leave the kernel module 
waiting on wait_for_completion and may stuck a lot of processes.

The following patch allows the load of ib_cm module with a limit on the timeout.

Signed-off-by: Ishai Rabinovitz <ishai at mellanox.co.il>

---


Index: last_stable/drivers/infiniband/core/cm.c
===================================================================
--- last_stable.orig/drivers/infiniband/core/cm.c	2006-10-03 15:30:38.000000000 +0200
+++ last_stable/drivers/infiniband/core/cm.c	2006-10-03 15:39:53.000000000 +0200
@@ -54,6 +54,13 @@ MODULE_AUTHOR("Sean Hefty");
 MODULE_DESCRIPTION("InfiniBand CM");
 MODULE_LICENSE("Dual BSD/GPL");
 
+static int mra_timeout_limit = 0;
+
+module_param(mra_timeout_limit, int, 0444);
+MODULE_PARM_DESC(mra_timeout_limit,
+                 "Limit the MRA timeout according to this value if != 0");
+
+
 static void cm_add_one(struct ib_device *device);
 static void cm_remove_one(struct ib_device *device);
 
@@ -2297,6 +2304,9 @@ static int cm_mra_handler(struct cm_work
 	timeout = cm_convert_to_ms(cm_mra_get_service_timeout(mra_msg)) +
 		  cm_convert_to_ms(cm_id_priv->av.packet_life_time);
 
+	if (mra_timeout_limit && timeout > mra_timeout_limit)
+		timeout = mra_timeout_limit;
+
 	spin_lock_irqsave(&cm_id_priv->lock, flags);
 	switch (cm_id_priv->id.state) {
 	case IB_CM_REQ_SENT:
-- 
Ishai Rabinovitz




More information about the general mailing list