diff options
author | David Howells <dhowells@redhat.com> | 2018-11-12 17:33:22 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-11-15 14:35:40 -0500 |
commit | 7150ceaacb27f7b3bf494e72cd4be4e11612dfff (patch) | |
tree | cdb1fb191dc649c0f1563045fe17ef0630690b2c /net/rxrpc | |
parent | ebcd210e93b2a984b7a7b82d45f7f0d21b7ec2d2 (diff) |
rxrpc: Fix life check
The life-checking function, which is used by kAFS to make sure that a call
is still live in the event of a pending signal, only samples the received
packet serial number counter; it doesn't actually provoke a change in the
counter, rather relying on the server to happen to give us a packet in the
time window.
Fix this by adding a function to force a ping to be transmitted.
kAFS then keeps track of whether there's been a stall, and if so, uses the
new function to ping the server, resetting the timeout to allow the reply
to come back.
If there's a stall, a ping and the call is *still* stalled in the same
place after another period, then the call will be aborted.
Fixes: bc5e3a546d55 ("rxrpc: Use MSG_WAITALL to tell sendmsg() to temporarily ignore signals")
Fixes: f4d15fb6f99a ("rxrpc: Provide functions for allowing cleaner handling of signals")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rxrpc')
-rw-r--r-- | net/rxrpc/af_rxrpc.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index 64362d078da8..a2522f9d71e2 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c | |||
@@ -375,17 +375,36 @@ EXPORT_SYMBOL(rxrpc_kernel_end_call); | |||
375 | * getting ACKs from the server. Returns a number representing the life state | 375 | * getting ACKs from the server. Returns a number representing the life state |
376 | * which can be compared to that returned by a previous call. | 376 | * which can be compared to that returned by a previous call. |
377 | * | 377 | * |
378 | * If this is a client call, ping ACKs will be sent to the server to find out | 378 | * If the life state stalls, rxrpc_kernel_probe_life() should be called and |
379 | * whether it's still responsive and whether the call is still alive on the | 379 | * then 2RTT waited. |
380 | * server. | ||
381 | */ | 380 | */ |
382 | u32 rxrpc_kernel_check_life(struct socket *sock, struct rxrpc_call *call) | 381 | u32 rxrpc_kernel_check_life(const struct socket *sock, |
382 | const struct rxrpc_call *call) | ||
383 | { | 383 | { |
384 | return call->acks_latest; | 384 | return call->acks_latest; |
385 | } | 385 | } |
386 | EXPORT_SYMBOL(rxrpc_kernel_check_life); | 386 | EXPORT_SYMBOL(rxrpc_kernel_check_life); |
387 | 387 | ||
388 | /** | 388 | /** |
389 | * rxrpc_kernel_probe_life - Poke the peer to see if it's still alive | ||
390 | * @sock: The socket the call is on | ||
391 | * @call: The call to check | ||
392 | * | ||
393 | * In conjunction with rxrpc_kernel_check_life(), allow a kernel service to | ||
394 | * find out whether a call is still alive by pinging it. This should cause the | ||
395 | * life state to be bumped in about 2*RTT. | ||
396 | * | ||
397 | * The must be called in TASK_RUNNING state on pain of might_sleep() objecting. | ||
398 | */ | ||
399 | void rxrpc_kernel_probe_life(struct socket *sock, struct rxrpc_call *call) | ||
400 | { | ||
401 | rxrpc_propose_ACK(call, RXRPC_ACK_PING, 0, 0, true, false, | ||
402 | rxrpc_propose_ack_ping_for_check_life); | ||
403 | rxrpc_send_ack_packet(call, true, NULL); | ||
404 | } | ||
405 | EXPORT_SYMBOL(rxrpc_kernel_probe_life); | ||
406 | |||
407 | /** | ||
389 | * rxrpc_kernel_get_epoch - Retrieve the epoch value from a call. | 408 | * rxrpc_kernel_get_epoch - Retrieve the epoch value from a call. |
390 | * @sock: The socket the call is on | 409 | * @sock: The socket the call is on |
391 | * @call: The call to query | 410 | * @call: The call to query |