[openib-general] Re: [PATCH] cm refcount race fix

Roland Dreier rdreier at cisco.com
Mon May 8 09:54:07 PDT 2006


 > static inline int get_obj_refcount(struct foo *obj)
 > {
 >         int c;
 > 
 >         spin_lock_irq(&obj->lock);
 >         c = atomic_read(&obj->refcount);
 >         spin_unlock_irq(&obj->lock);
 > 
 >         return c;
 > }
 > 
 > be acceptable?

That looks pretty silly to me.  Especially since you need the lock
around the atomic_dec too.

Changing the refcount to an int doesn't seem like that daunting a
change to make...

 - R.



More information about the general mailing list