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

Roland Dreier roland at topspin.com
Mon Nov 8 11:12:03 PST 2004


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