[openib-general] [PATCH] ib_mad: prevent duplicate outstanding MAD transactions with same TID.

Jack Morgenstein jackm at mellanox.co.il
Wed Jan 18 05:05:36 PST 2006


Prevent multiple outstanding MAD transactions with the same TID.
Could happen if duplicate requests are posted.

Signed-off-by: Jack Morgenstein <jackm at mellanox.co.il>

Index: latest/drivers/infiniband/core/mad.c
===================================================================
--- latest.orig/drivers/infiniband/core/mad.c
+++ latest/drivers/infiniband/core/mad.c
@@ -964,6 +964,12 @@ int ib_post_send_mad(struct ib_mad_send_
 		/* Reference MAD agent until send completes */
 		atomic_inc(&mad_agent_priv->refcount);
 		spin_lock_irqsave(&mad_agent_priv->lock, flags);
+		if (ib_find_send_mad(mad_agent_priv, mad_send_wr->tid)) {
+			/* Duplicate send request */
+			spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
+			atomic_dec(&mad_agent_priv->refcount);
+			return -EBUSY;
+		}
 		list_add_tail(&mad_send_wr->agent_list,
 			      &mad_agent_priv->send_list);
 		spin_unlock_irqrestore(&mad_agent_priv->lock, flags);



More information about the general mailing list