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

Michael S. Tsirkin mst at mellanox.co.il
Mon May 8 09:06:14 PDT 2006


Quoting r. Roland Dreier <rdreier at cisco.com>:
> Subject: Re: [PATCH] cm refcount race fix
> 
>  > +	/* 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.

This does not parse:

 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);
 }

cm_deref_id does nothing outside the lock.



-- 
MST



More information about the general mailing list