On 30 August 2012 04:23, Vijay Singh <vijju.si...@gmail.com> wrote:
> Is there any reason why sorele() needs the accept lock to be held?
>
>   231 #define sorele(so) do {                                                 
> \
>   232         ACCEPT_LOCK_ASSERT();                                           
> \
>   233         SOCK_LOCK_ASSERT(so);                                           
> \
>   234         if ((so)->so_count <= 0)                                        
> \
>   235                 panic("sorele");                                        
> \
>   236         if (--(so)->so_count == 0)                                      
> \
>   237                 sofree(so);                                             
> \
>   238         else {                                                          
> \
>   239                 SOCK_UNLOCK(so);                                        
> \
>   240                 ACCEPT_UNLOCK();                                        
> \
>   241         }                                                               
> \
>   242 } while (0)

sofree() needs accept lock to be held to operate on a qstate field.
sofree() callers cannot be changed to push accept lock acquisition into
sofree() because that would require to reacquire sock lock around accept
lock to take locks in order; this in turn opens race.
See r136682 for details.

-- 
wbr,
pluknet
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to