linux/net/rxrpc
David Howells e653cfe49c rxrpc: Release a call's connection ref on call disconnection
When a call is disconnected, clear the call's pointer to the connection and
release the associated ref on that connection.  This means that the call no
longer pins the connection and the connection can be discarded even before
the call is.

As the code currently stands, the call struct is effectively pinned by
userspace until userspace has enacted a recvmsg() to retrieve the final
call state as sk_buffs on the receive queue pin the call to which they're
related because:

 (1) The rxrpc_call struct contains the userspace ID that recvmsg() has to
     include in the control message buffer to indicate which call is being
     referred to.  This ID must remain valid until the terminal packet is
     completely read and must be invalidated immediately at that point as
     userspace is entitled to immediately reuse it.

 (2) The final ACK to the reply to a client call isn't sent until the last
     data packet is entirely read (it's probably worth altering this in
     future to be send the ACK as soon as all the data has been received).


This change requires a bit of rearrangement to make sure that the call
isn't going to try and access the connection again after protocol
completion:

 (1) Delete the error link earlier when we're releasing the call.  Possibly
     network errors should be distributed via connections at the cost of
     adding in an access to the rxrpc_connection struct.

 (2) Remove the call from the connection's call tree before disconnecting
     the call.  The call tree needs to be removed anyway and incoming
     packets delivered by channel pointer instead.

 (3) The release call event should be considered last after all other
     events have been processed so that we don't need access to the
     connection again.

 (4) Move the channel_lock taking from rxrpc_release_call() to
     rxrpc_disconnect_call() where it will be required in future.

Signed-off-by: David Howells <dhowells@redhat.com>
2016-07-06 10:43:51 +01:00
..
af_rxrpc.c rxrpc: Check that the client conns cache is empty before module removal 2016-07-06 10:43:51 +01:00
ar-internal.h rxrpc: Move usage count getting into rxrpc_queue_conn() 2016-07-06 10:43:51 +01:00
call_accept.c rxrpc: Move usage count getting into rxrpc_queue_conn() 2016-07-06 10:43:51 +01:00
call_event.c rxrpc: Release a call's connection ref on call disconnection 2016-07-06 10:43:51 +01:00
call_object.c rxrpc: Release a call's connection ref on call disconnection 2016-07-06 10:43:51 +01:00
conn_client.c rxrpc: Check that the client conns cache is empty before module removal 2016-07-06 10:43:51 +01:00
conn_event.c rxrpc: Move usage count getting into rxrpc_queue_conn() 2016-07-06 10:43:51 +01:00
conn_object.c rxrpc: Release a call's connection ref on call disconnection 2016-07-06 10:43:51 +01:00
input.c rxrpc: Move usage count getting into rxrpc_queue_conn() 2016-07-06 10:43:51 +01:00
insecure.c rxrpc: Avoid using stack memory in SG lists in rxkad 2016-07-06 10:43:05 +01:00
Kconfig rxrpc: Absorb the rxkad security module 2016-04-11 15:34:41 -04:00
key.c rxrpc: Use structs to hold connection params and protocol info 2016-06-22 09:09:59 +01:00
local_event.c rxrpc: Rework local endpoint management 2016-06-15 15:38:17 +01:00
local_object.c rxrpc: Kill the client connection bundle concept 2016-06-22 09:20:55 +01:00
Makefile rxrpc: Kill off the rxrpc_transport struct 2016-06-22 14:00:23 +01:00
misc.c rxrpc: Limit the listening backlog 2016-06-10 18:14:47 -07:00
output.c rxrpc: Kill off the rxrpc_transport struct 2016-06-22 14:00:23 +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: Kill off the rxrpc_transport struct 2016-06-22 14:00:23 +01:00
proc.c rxrpc: Turn connection #defines into enums and put outside struct def 2016-07-06 10:43:51 +01:00
recvmsg.c rxrpc: Replace conn->trans->{local,peer} with conn->params.{local,peer} 2016-06-22 09:10:00 +01:00
rxkad.c rxrpc: Avoid using stack memory in SG lists in rxkad 2016-07-06 10:43:05 +01:00
security.c rxrpc: Replace conn->trans->{local,peer} with conn->params.{local,peer} 2016-06-22 09:10:00 +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: Kill off the rxrpc_transport struct 2016-06-22 14:00:23 +01:00
utils.c rxrpc: Rework peer object handling to use hash table and RCU 2016-06-15 10:12:33 +01:00