[openib-general] Re: [PATCH] cm refcount race fix
Sean Hefty
mshefty at ichips.intel.com
Mon May 8 15:05:30 PDT 2006
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.
- Sean
More information about the general
mailing list