[openib-general] [PATCH] Encapsulate finding of id in sa_query.c

Krishna Kumar krkumar at us.ibm.com
Mon Nov 8 11:18:50 PST 2004


Good catch Sean.

Yes, but since it is a race (hence uncommon), isn't it enough to let the
ib_cancel_mad handle it ? It drops out if find_send_by_wr_id fails to find
this entry.

- KK

On Mon, 8 Nov 2004, Roland Dreier wrote:

> Actually looking at this code one more time:
>
> 	spin_lock_irqsave(&idr_lock, flags);
> 	if (idr_find(&query_idr, query->id) != query) {
> 		spin_unlock_irqrestore(&idr_lock, flags);
> 		return;
> 	}
> 	spin_unlock_irqrestore(&idr_lock, flags);
>
> 	ib_cancel_mad(query->port->agent, query->id);
>
> I realize that it has a race.  I check that the query is still around
> inside the spinlock, but the query could complete and be freed in
> between the unlock and the call to ib_cancel_mad().  I'll have to add
> some reference counting...
>
>  - R.





More information about the general mailing list