1. 18 Mar, 2015 8 commits
    • Ying Xue's avatar
      tipc: fix netns refcnt leak · 76100a8a
      Ying Xue authored
      When the TIPC module is loaded, we launch a topology server in kernel
      space, which in its turn is creating TIPC sockets for communication
      with topology server users. Because both the socket's creator and
      provider reside in the same module, it is necessary that the TIPC
      module's reference count remains zero after the server is started and
      the socket created; otherwise it becomes impossible to perform "rmmod"
      even on an idle module.
      
      Currently, we achieve this by defining a separate "tipc_proto_kern"
      protocol struct, that is used only for kernel space socket allocations.
      This structure has the "owner" field set to NULL, which restricts the
      module reference count from being be bumped when sk_alloc() for local
      sockets is called. Furthermore, we have defined three kernel-specific
      functions, tipc_sock_create_local(), tipc_sock_release_local() and
      tipc_sock_accept_local(), to avoid the module counter being modified
      when module local sockets are created or deleted. This has worked well
      until we introduced name space support.
      
      However, after name space support was introduced, we have observed that
      a reference count leak occurs, because the netns counter is not
      decremented in tipc_sock_delete_local().
      
      This commit remedies this problem. But instead of just modifying
      tipc_sock_delete_local(), we eliminate the whole parallel socket
      handling infrastructure, and start using the regular sk_create_kern(),
      kernel_accept() and sk_release_kernel() calls. Since those functions
      manipulate the module counter, we must now compensate for that by
      explicitly decrementing the counter after module local sockets are
      created, and increment it just before calling sk_release_kernel().
      
      Fixes: a62fbcce ("tipc: make subscriber server support net namespace")
      Signed-off-by: default avatarYing Xue <ying.xue@windriver.com>
      Reviewed-by: default avatarJon Maloy <jon.maloy@ericson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Reported-by: default avatarCong Wang <cwang@twopensource.com>
      Tested-by: default avatarErik Hugne <erik.hugne@ericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      76100a8a
    • David S. Miller's avatar
      Merge branch 'listener_refactor_part_12' · 52841430
      David S. Miller authored
      Eric Dumazet says:
      
      ====================
      inet: tcp listener refactoring, part 12
      
      By adding a pointer back to listener, we are preparing synack rtx
      handling to no longer be governed by listener keepalive timer,
      as this is the most problematic source of contention on listener
      spinlock. Note that TCP FastOpen had such pointer anyway, so we
      make it generic.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      52841430
    • Eric Dumazet's avatar
      inet: fix request sock refcounting · 0470c8ca
      Eric Dumazet authored
      While testing last patch series, I found req sock refcounting was wrong.
      
      We must set skc_refcnt to 1 for all request socks added in hashes,
      but also on request sockets created by FastOpen or syncookies.
      
      It is tricky because we need to defer this initialization so that
      future RCU lookups do not try to take a refcount on a not yet
      fully initialized request socket.
      
      Also get rid of ireq_refcnt alias.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Fixes: 13854e5a ("inet: add proper refcounting to request sock")
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0470c8ca
    • Eric Dumazet's avatar
      inet: avoid fastopen lock for regular accept() · e3d95ad7
      Eric Dumazet authored
      It is not because a TCP listener is FastOpen ready that
      all incoming sockets actually used FastOpen.
      
      Avoid taking queue->fastopenq->lock if not needed.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e3d95ad7
    • Eric Dumazet's avatar
      tcp: rename struct tcp_request_sock listener · 9439ce00
      Eric Dumazet authored
      The listener field in struct tcp_request_sock is a pointer
      back to the listener. We now have req->rsk_listener, so TCP
      only needs one boolean and not a full pointer.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9439ce00
    • Eric Dumazet's avatar
      inet: add rsk_listener field to struct request_sock · 4e9a578e
      Eric Dumazet authored
      Once we'll be able to lookup request sockets in ehash table,
      we'll need to get access to listener which created this request.
      
      This avoid doing a lookup to find the listener, which benefits
      for a more solid SO_REUSEPORT, and is needed once we no
      longer queue request sock into a listener private queue.
      
      Note that 'struct tcp_request_sock'->listener could be reduced
      to a single bit, as TFO listener should match req->rsk_listener.
      TFO will no longer need to hold a reference on the listener.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4e9a578e
    • Eric Dumazet's avatar
      inet: uninline inet_reqsk_alloc() · e49bb337
      Eric Dumazet authored
      inet_reqsk_alloc() is becoming fat and should not be inlined.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e49bb337
    • Eric Dumazet's avatar
      inet: add sk_listener argument to inet_reqsk_alloc() · 407640de
      Eric Dumazet authored
      listener socket can be used to set net pointer, and will
      be later used to hold a reference on listener.
      
      Add a const qualifier to first argument (struct request_sock_ops *),
      and factorize all write_pnet(&ireq->ireq_net, sock_net(sk));
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      407640de
  2. 17 Mar, 2015 25 commits
  3. 16 Mar, 2015 7 commits