diff options
author | David Howells <dhowells@redhat.com> | 2016-10-06 03:11:49 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2016-10-06 03:11:49 -0400 |
commit | b3156274ca01297b861e912175820e78c9ac4d7c (patch) | |
tree | afa5a44c0f57db3ce8f442b50fd9460501d9a431 | |
parent | a5af7e1fc69a46f29b977fd4b570e0ac414c2338 (diff) |
rxrpc: Partially handle OpenAFS's improper termination of calls
OpenAFS doesn't always correctly terminate client calls that it makes -
this includes calls the OpenAFS servers make to the cache manager service.
It should end the client call with either:
(1) An ACK that has firstPacket set to one greater than the seq number of
the reply DATA packet with the LAST_PACKET flag set (thereby
hard-ACK'ing all packets). nAcks should be 0 and acks[] should be
empty (ie. no soft-ACKs).
(2) An ACKALL packet.
OpenAFS, though, may send an ACK packet with firstPacket set to the last
seq number or less and soft-ACKs listed for all packets up to and including
the last DATA packet.
The transmitter, however, is obliged to keep the call live and the
soft-ACK'd DATA packets around until they're hard-ACK'd as the receiver is
permitted to drop any merely soft-ACK'd packet and request retransmission
by sending an ACK packet with a NACK in it.
Further, OpenAFS will also terminate a client call by beginning the next
client call on the same connection channel. This implicitly completes the
previous call.
This patch handles implicit ACK of a call on a channel by the reception of
the first packet of the next call on that channel.
If another call doesn't come along to implicitly ACK a call, then we have
to time the call out. There are some bugs there that will be addressed in
subsequent patches.
Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r-- | net/rxrpc/input.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c index a6da83f036d6..44fb8d893c7d 100644 --- a/net/rxrpc/input.c +++ b/net/rxrpc/input.c | |||
@@ -939,6 +939,33 @@ static void rxrpc_input_call_packet(struct rxrpc_call *call, | |||
939 | } | 939 | } |
940 | 940 | ||
941 | /* | 941 | /* |
942 | * Handle a new call on a channel implicitly completing the preceding call on | ||
943 | * that channel. | ||
944 | * | ||
945 | * TODO: If callNumber > call_id + 1, renegotiate security. | ||
946 | */ | ||
947 | static void rxrpc_input_implicit_end_call(struct rxrpc_connection *conn, | ||
948 | struct rxrpc_call *call) | ||
949 | { | ||
950 | switch (call->state) { | ||
951 | case RXRPC_CALL_SERVER_AWAIT_ACK: | ||
952 | rxrpc_call_completed(call); | ||
953 | break; | ||
954 | case RXRPC_CALL_COMPLETE: | ||
955 | break; | ||
956 | default: | ||
957 | if (rxrpc_abort_call("IMP", call, 0, RX_CALL_DEAD, ESHUTDOWN)) { | ||
958 | set_bit(RXRPC_CALL_EV_ABORT, &call->events); | ||
959 | rxrpc_queue_call(call); | ||
960 | } | ||
961 | break; | ||
962 | } | ||
963 | |||
964 | __rxrpc_disconnect_call(conn, call); | ||
965 | rxrpc_notify_socket(call); | ||
966 | } | ||
967 | |||
968 | /* | ||
942 | * post connection-level events to the connection | 969 | * post connection-level events to the connection |
943 | * - this includes challenges, responses, some aborts and call terminal packet | 970 | * - this includes challenges, responses, some aborts and call terminal packet |
944 | * retransmission. | 971 | * retransmission. |
@@ -1146,6 +1173,16 @@ void rxrpc_data_ready(struct sock *udp_sk) | |||
1146 | } | 1173 | } |
1147 | 1174 | ||
1148 | call = rcu_dereference(chan->call); | 1175 | call = rcu_dereference(chan->call); |
1176 | |||
1177 | if (sp->hdr.callNumber > chan->call_id) { | ||
1178 | if (!(sp->hdr.flags & RXRPC_CLIENT_INITIATED)) { | ||
1179 | rcu_read_unlock(); | ||
1180 | goto reject_packet; | ||
1181 | } | ||
1182 | if (call) | ||
1183 | rxrpc_input_implicit_end_call(conn, call); | ||
1184 | call = NULL; | ||
1185 | } | ||
1149 | } else { | 1186 | } else { |
1150 | skew = 0; | 1187 | skew = 0; |
1151 | call = NULL; | 1188 | call = NULL; |