[openib-general] [PATCH] Encapsulate finding of id in sa_query.c
    Sean Hefty 
    mshefty at ichips.intel.com
       
    Mon Nov  8 11:07:54 PST 2004
    
    
  
Krishna Kumar wrote:
> Actually three places ... And IMO, it does make the locking code look
> cleaner, eg, the original code (with multiple unlocks) :
> 
> void ib_sa_cancel_query(int id, struct ib_sa_query *query)
> {
>         unsigned long flags;
> 
>         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 admit that I haven't looked at the SA code yet, but can 
ib_sa_cancel_query pass straight through to ib_cancel_mad?  Since the 
lock is not held around both the find and the cancel, it seems possible.
- Sean
    
    
More information about the general
mailing list