linux/net/rxrpc
David Howells 4f95dd78a7 rxrpc: Rework local endpoint management
Rework the local RxRPC endpoint management.

Local endpoint objects are maintained in a flat list as before.  This
should be okay as there shouldn't be more than one per open AF_RXRPC socket
(there can be fewer as local endpoints can be shared if their local service
ID is 0 and they share the same local transport parameters).

Changes:

 (1) Local endpoints may now only be shared if they have local service ID 0
     (ie. they're not being used for listening).

     This prevents a scenario where process A is listening of the Cache
     Manager port and process B contacts a fileserver - which may then
     attempt to send CM requests back to B.  But if A and B are sharing a
     local endpoint, A will get the CM requests meant for B.

 (2) We use a mutex to handle lookups and don't provide RCU-only lookups
     since we only expect to access the list when opening a socket or
     destroying an endpoint.

     The local endpoint object is pointed to by the transport socket's
     sk_user_data for the life of the transport socket - allowing us to
     refer to it directly from the sk_data_ready and sk_error_report
     callbacks.

 (3) atomic_inc_not_zero() now exists and can be used to only share a local
     endpoint if the last reference hasn't yet gone.

 (4) We can remove rxrpc_local_lock - a spinlock that had to be taken with
     BH processing disabled given that we assume sk_user_data won't change
     under us.

 (5) The transport socket is shut down before we clear the sk_user_data
     pointer so that we can be sure that the transport socket's callbacks
     won't be invoked once the RCU destruction is scheduled.

 (6) Local endpoints have a work item that handles both destruction and
     event processing.  The means that destruction doesn't then need to
     wait for event processing.  The event queues can then be cleared after
     the transport socket is shut down.

 (7) Local endpoints are no longer available for resurrection beyond the
     life of the sockets that had them open.  As soon as their last ref
     goes, they are scheduled for destruction and may not have their usage
     count moved from 0.

Signed-off-by: David Howells <dhowells@redhat.com>
2016-06-15 15:38:17 +01:00
..
af_rxrpc.c rxrpc: Rework local endpoint management 2016-06-15 15:38:17 +01:00
ar-internal.h rxrpc: Rework local endpoint management 2016-06-15 15:38:17 +01:00
call_accept.c rxrpc: Rework local endpoint management 2016-06-15 15:38:17 +01:00
call_event.c rxrpc: Use the peer record to distribute network errors 2016-06-15 10:15:16 +01:00
call_object.c rxrpc: Use the peer record to distribute network errors 2016-06-15 10:15:16 +01:00
conn_event.c rxrpc: Rework local endpoint management 2016-06-15 15:38:17 +01:00
conn_object.c rxrpc: Rename files matching ar-*.c to git rid of the "ar-" prefix 2016-06-13 12:16:05 +01:00
input.c rxrpc: Rework local endpoint management 2016-06-15 15:38:17 +01:00
insecure.c rxrpc: Create a null security type and get rid of conditional calls 2016-04-11 15:34:41 -04:00
Kconfig rxrpc: Absorb the rxkad security module 2016-04-11 15:34:41 -04:00
key.c rxrpc: Rename files matching ar-*.c to git rid of the "ar-" prefix 2016-06-13 12:16:05 +01:00
local_event.c rxrpc: Rework local endpoint management 2016-06-15 15:38:17 +01:00
local_object.c rxrpc: Rework local endpoint management 2016-06-15 15:38:17 +01:00
Makefile rxrpc: Separate local endpoint event handling out into its own file 2016-06-15 15:37:12 +01:00
misc.c rxrpc: Limit the listening backlog 2016-06-10 18:14:47 -07:00
output.c rxrpc: Use the peer record to distribute network errors 2016-06-15 10:15:16 +01:00
peer_event.c rxrpc: Use the peer record to distribute network errors 2016-06-15 10:15:16 +01:00
peer_object.c rxrpc: Use the peer record to distribute network errors 2016-06-15 10:15:16 +01:00
proc.c rxrpc: Rename files matching ar-*.c to git rid of the "ar-" prefix 2016-06-13 12:16:05 +01:00
recvmsg.c rxrpc: Rename files matching ar-*.c to git rid of the "ar-" prefix 2016-06-13 12:16:05 +01:00
rxkad.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-06-10 11:52:24 -07:00
security.c rxrpc: Rename files matching ar-*.c to git rid of the "ar-" prefix 2016-06-13 12:16:05 +01:00
skbuff.c rxrpc: Rename files matching ar-*.c to git rid of the "ar-" prefix 2016-06-13 12:16:05 +01:00
sysctl.c rxrpc: Limit the listening backlog 2016-06-10 18:14:47 -07:00
transport.c rxrpc: Use the peer record to distribute network errors 2016-06-15 10:15:16 +01:00
utils.c rxrpc: Rework peer object handling to use hash table and RCU 2016-06-15 10:12:33 +01:00