[ofa-general] [PATCH 1/2] IB/core: handle race between elements in qork queues after event

Moni Shoua monis at Voltaire.COM
Tue May 20 07:05:26 PDT 2008


Roland Dreier wrote:
>  > > 		spin_lock_irqsave(&port->ah_lock, flags);
>  > > 		if (port->sm_ah)
>  > > 			kref_put(&port->sm_ah->ref, free_sm_ah);
>  > > 		port->sm_ah = NULL;
>  > > 		spin_unlock_irqrestore(&port->ah_lock, flags);
>  > > 
>  > What happens if this happens
>  > 
>  > # |         CPU-0					|	CPU-1
>  >   |      						|
>  > 1 | if (port->sm_ah)					|
>  >   |      kref_put(&port->sm_ah->ref, free_sm_ah);	|
>  > --+-----------------------------------------------------+-----------------------
>  > 2 |							| alloc_mad() 
>  > --+-----------------------------------------------------+-----------------------
>  > 3 | port->sm_ah = NULL;					|
>  > 
>  > As I see it, process on CPU-1 gets a garbage sm_ah
>  > Do you agree?
> 
> alloc_mad() must obviously take the lock when looking at port->sm_ah,
> and take a reference with kref_get() before dropping the lock.
> 
>  - R.
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
> 
You're right. 
I just sent a V2 but it needs to be modified according to above.
I'll resend soon

thanks
 



More information about the general mailing list