+int ib_cancel_mad(struct ib_mad_agent *mad_agent,
+                 u64 wr_id)

Is wr_id enough to identify a sent MAD?  I guess this imposes the
requirement that consumers must not use duplicate wr_ids.

+{
+       struct ib_mad_agent_private *mad_agent_priv;
+       struct ib_mad_send_wr_private *mad_send_wr;
+       struct ib_mad_send_wc mad_send_wc;
+       unsigned long flags;
+
+       mad_agent_priv = container_of(mad_agent, struct ib_mad_agent_private,
+                                     agent);
+       spin_lock_irqsave(&mad_agent_priv->send_list_lock, flags);
+       list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list,
+                           agent_send_list) {
+               if (mad_send_wr->wr_id == wr_id)
+                       goto found;
+       }
+       spin_unlock_irqrestore(&mad_agent_priv->send_list_lock, flags);
+       return -EINVAL;

This is exactly the issue I was talking about last time.  Since we
remove the MAD from the send list before calling the consumer's send
handler, it's entirely possible for ib_cancel_mad() to return -EINVAL
with the send handler still running on another CPU ... oops.

 - R.
_______________________________________________
openib-general mailing list
[EMAIL PROTECTED]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to