[openib-general] Re: [PATCH] cm refcount race fix
Michael S. Tsirkin
mst at mellanox.co.il
Mon May 8 15:13:38 PDT 2006
Quoting r. Sean Hefty <mshefty at ichips.intel.com>:
> Subject: Re: [openib-general] Re: [PATCH] cm refcount race fix
>
> Michael S. Tsirkin wrote:
> > static inline void cm_deref_id(struct cm_id_private *cm_id_priv)
> > {
> >+ unsigned long flags;
> >+
> >+ spin_lock_irqsave(&cm_id_priv->lock, flags);
> > if (atomic_dec_and_test(&cm_id_priv->refcount))
> > wake_up(&cm_id_priv->wait);
> >+ spin_unlock_irqrestore(&cm_id_priv->lock, flags);
> > }
>
> Could we use atomic_dec_and_lock() instead? This would keep refcount
> atomic, but use a spinlock to synchronize with destruction.
I think that'd work too.
--
MST
More information about the general
mailing list