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

Tom Tucker tom at opengridcomputing.com
Mon May 8 09:15:19 PDT 2006


sry...i responded to Roland's Q without reading the whole thread -- the
pox on me!

On Mon, 2006-05-08 at 19:07 +0300, Michael S. Tsirkin wrote:
> Quoting r. Tom Tucker <tom at opengridcomputing.com>:
> > Subject: Re: [openib-general] Re: [PATCH] cm refcount race fix
> > 
> > On Mon, 2006-05-08 at 08:53 -0700, Roland Dreier wrote:
> > >  > +	/* Make sure cm_deref_id is not in progress */
> > >  > +	spin_lock_irq(&cm_id_priv->lock);
> > >  > +	spin_unlock_irq(&cm_id_priv->lock);
> > > 
> > > How does this help anything?  cm_deref_id() can still be in progress,
> > > it just can't hold the lock during this empty section of code.
> > > 
> > 
> > Maybe Michael means this...
> > 
> > 
> > T1
> > 	
> > 	spin_lock_irq(&obj->lock);
> > 	if (atomic_dec_and_test(&obj->refcount))
> > 		wake_up(&obj->wait);
> > 	spin_unlock_irq(&obj->lock);
> > 
> > T2
> > 
> > 	atomic_dec(&obj->refcount);
> > 	wait_event(&obj->wait, !atomic_read(&obj->refcount))
> > 	spin_lock_irq(&obj->lock);
> > 	spin_unlock_irq(&obj->lock);
> > 	kfree(obj);
> > 
> 
> Right, that's what the patch does. No?
> 




More information about the general mailing list