[netmp] socket accesses

Aggelos Economopoulos aoiko at cc.ece.ntua.gr
Sun Aug 17 16:56:13 PDT 2008


On Monday 18 August 2008, Matthew Dillon wrote:
> :So, atomic or non-atomic op, if we race here, the mbufs can stay in the sockbuf
> :for ever...
> 
>     The current code does not clean out the sockbuf when setting
>     SS_CANTRCVMORE.  I think data already queued stays in there until read
>     by userland or until the socket is closed.  So it shouldn't matter if
>     an extra packet or two gets in there while the socket is still open.

Right.

> :..
> :> if (so->so_state & SS_CANTRCVMORE) {
> :>         soisdisconnected(so);
> :>         callout_reset(tp->tt_2msl, tcp_maxidle,
> :>                       tcp_timer_2msl, tp);
> :> }
> :
> :And if we race here, we'll never disconnect the socket.
> :..
> :Aggelos
> 
>     This code looks like an optimization to me.  It shouldn't matter whether
>     the conditional occurs or not.  All it does is shortcut the FIN2 state
>     because there are no longer any readers that might need data received
>     during that state.
> 
>     If it misses the case it would be as if the user shutdown a microsecond
>     after the remote end initiated a close sequence instead of a microsecond
>     before.

Hmm. Yeah, makes sense. All is well then. Thanks!

Aggelos





More information about the Kernel mailing list