git: tcp: Allow socket/syncache inheritance between SO_REUSEPORT listen sockets

Sepherosa Ziehau sephe at crater.dragonflybsd.org
Thu Aug 1 01:13:56 PDT 2013


commit 02ad2f0b874fb0a45eb69750219f79f5e8982272
Author: Sepherosa Ziehau <sephe at dragonflybsd.org>
Date:   Wed Jul 31 16:31:02 2013 +0800

    tcp: Allow socket/syncache inheritance between SO_REUSEPORT listen sockets
    
    This is intend to address the drawback of the following SO_REUSEPORT tcp
    listen socket usage model:
    Multiple processses create their own listen socket w/ SO_REUSEPORT, if
    one of the process crashed, i.e. the listen socket is closed, then any
    syncache, pending sockets on the completion and incompletion queues
    are just dropped.
    
    Compared w/ multiple processes sharing the same tcp listen socket, this
    drawback could be unacceptable (e.g. when nginx reload configure).
    
    This commit addresses this drawback by allowing another tcp listen socket
    in the same local group, i.e. bound to the same listen port and address,
    to inherit the syncache and pending sockets of the to-be-closed tcp
    listen socket.  The tcp listen socket, which inherits the syncache and
    pending sockets, is the last tcp listen socket in the same local group.

Summary of changes:
 sys/kern/uipc_socket.c     | 67 ++++++++++++++++++++++++++++++++++++++++++++++
 sys/netinet/in_pcb.c       | 40 +++++++++++++++++++++++++++
 sys/netinet/in_pcb.h       |  2 ++
 sys/netinet/tcp_subr.c     | 39 ++++++++++++++++++++++++---
 sys/netinet/tcp_syncache.c |  4 +--
 sys/netinet/tcp_var.h      |  2 +-
 sys/sys/socketvar.h        |  1 +
 7 files changed, 149 insertions(+), 6 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/02ad2f0b874fb0a45eb69750219f79f5e8982272


-- 
DragonFly BSD source repository



More information about the Commits mailing list