diff options
author | Marc Dionne <marc.dionne@auristor.com> | 2019-04-12 11:33:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-12 19:57:23 -0400 |
commit | 4611da30d679a4b0a2c2b5d4d7b3fbbafc922df7 (patch) | |
tree | 0133479c4cbec6c1bdd2715cb0b2152d73252596 | |
parent | 56d282d9db19f85f759b7a81f0829b58c00571b0 (diff) |
rxrpc: Make rxrpc_kernel_check_life() indicate if call completed
Make rxrpc_kernel_check_life() pass back the life counter through the
argument list and return true if the call has not yet completed.
Suggested-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | Documentation/networking/rxrpc.txt | 16 | ||||
-rw-r--r-- | fs/afs/rxrpc.c | 4 | ||||
-rw-r--r-- | include/net/af_rxrpc.h | 4 | ||||
-rw-r--r-- | net/rxrpc/af_rxrpc.c | 14 |
4 files changed, 23 insertions, 15 deletions
diff --git a/Documentation/networking/rxrpc.txt b/Documentation/networking/rxrpc.txt index 2df5894353d6..cd7303d7fa25 100644 --- a/Documentation/networking/rxrpc.txt +++ b/Documentation/networking/rxrpc.txt | |||
@@ -1009,16 +1009,18 @@ The kernel interface functions are as follows: | |||
1009 | 1009 | ||
1010 | (*) Check call still alive. | 1010 | (*) Check call still alive. |
1011 | 1011 | ||
1012 | u32 rxrpc_kernel_check_life(struct socket *sock, | 1012 | bool rxrpc_kernel_check_life(struct socket *sock, |
1013 | struct rxrpc_call *call); | 1013 | struct rxrpc_call *call, |
1014 | u32 *_life); | ||
1014 | void rxrpc_kernel_probe_life(struct socket *sock, | 1015 | void rxrpc_kernel_probe_life(struct socket *sock, |
1015 | struct rxrpc_call *call); | 1016 | struct rxrpc_call *call); |
1016 | 1017 | ||
1017 | The first function returns a number that is updated when ACKs are received | 1018 | The first function passes back in *_life a number that is updated when |
1018 | from the peer (notably including PING RESPONSE ACKs which we can elicit by | 1019 | ACKs are received from the peer (notably including PING RESPONSE ACKs |
1019 | sending PING ACKs to see if the call still exists on the server). The | 1020 | which we can elicit by sending PING ACKs to see if the call still exists |
1020 | caller should compare the numbers of two calls to see if the call is still | 1021 | on the server). The caller should compare the numbers of two calls to see |
1021 | alive after waiting for a suitable interval. | 1022 | if the call is still alive after waiting for a suitable interval. It also |
1023 | returns true as long as the call hasn't yet reached the completed state. | ||
1022 | 1024 | ||
1023 | This allows the caller to work out if the server is still contactable and | 1025 | This allows the caller to work out if the server is still contactable and |
1024 | if the call is still alive on the server while waiting for the server to | 1026 | if the call is still alive on the server while waiting for the server to |
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c index 2c588f9bbbda..5cb11aff9298 100644 --- a/fs/afs/rxrpc.c +++ b/fs/afs/rxrpc.c | |||
@@ -621,7 +621,7 @@ static long afs_wait_for_call_to_complete(struct afs_call *call, | |||
621 | rtt2 = 2; | 621 | rtt2 = 2; |
622 | 622 | ||
623 | timeout = rtt2; | 623 | timeout = rtt2; |
624 | last_life = rxrpc_kernel_check_life(call->net->socket, call->rxcall); | 624 | rxrpc_kernel_check_life(call->net->socket, call->rxcall, &last_life); |
625 | 625 | ||
626 | add_wait_queue(&call->waitq, &myself); | 626 | add_wait_queue(&call->waitq, &myself); |
627 | for (;;) { | 627 | for (;;) { |
@@ -639,7 +639,7 @@ static long afs_wait_for_call_to_complete(struct afs_call *call, | |||
639 | if (afs_check_call_state(call, AFS_CALL_COMPLETE)) | 639 | if (afs_check_call_state(call, AFS_CALL_COMPLETE)) |
640 | break; | 640 | break; |
641 | 641 | ||
642 | life = rxrpc_kernel_check_life(call->net->socket, call->rxcall); | 642 | rxrpc_kernel_check_life(call->net->socket, call->rxcall, &life); |
643 | if (timeout == 0 && | 643 | if (timeout == 0 && |
644 | life == last_life && signal_pending(current)) { | 644 | life == last_life && signal_pending(current)) { |
645 | if (stalled) | 645 | if (stalled) |
diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h index 2bfb87eb98ce..78c856cba4f5 100644 --- a/include/net/af_rxrpc.h +++ b/include/net/af_rxrpc.h | |||
@@ -61,10 +61,12 @@ int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, | |||
61 | rxrpc_user_attach_call_t, unsigned long, gfp_t, | 61 | rxrpc_user_attach_call_t, unsigned long, gfp_t, |
62 | unsigned int); | 62 | unsigned int); |
63 | void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64); | 63 | void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64); |
64 | u32 rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *); | 64 | bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *, |
65 | u32 *); | ||
65 | void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *); | 66 | void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *); |
66 | u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *); | 67 | u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *); |
67 | bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *, | 68 | bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *, |
68 | ktime_t *); | 69 | ktime_t *); |
70 | bool rxrpc_kernel_call_is_complete(struct rxrpc_call *); | ||
69 | 71 | ||
70 | #endif /* _NET_RXRPC_H */ | 72 | #endif /* _NET_RXRPC_H */ |
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index c54dce3ca0dd..ae8c5d7f3bf1 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c | |||
@@ -371,18 +371,22 @@ EXPORT_SYMBOL(rxrpc_kernel_end_call); | |||
371 | * rxrpc_kernel_check_life - Check to see whether a call is still alive | 371 | * rxrpc_kernel_check_life - Check to see whether a call is still alive |
372 | * @sock: The socket the call is on | 372 | * @sock: The socket the call is on |
373 | * @call: The call to check | 373 | * @call: The call to check |
374 | * @_life: Where to store the life value | ||
374 | * | 375 | * |
375 | * Allow a kernel service to find out whether a call is still alive - ie. we're | 376 | * Allow a kernel service to find out whether a call is still alive - ie. we're |
376 | * getting ACKs from the server. Returns a number representing the life state | 377 | * getting ACKs from the server. Passes back in *_life a number representing |
377 | * which can be compared to that returned by a previous call. | 378 | * the life state which can be compared to that returned by a previous call and |
379 | * return true if the call is still alive. | ||
378 | * | 380 | * |
379 | * If the life state stalls, rxrpc_kernel_probe_life() should be called and | 381 | * If the life state stalls, rxrpc_kernel_probe_life() should be called and |
380 | * then 2RTT waited. | 382 | * then 2RTT waited. |
381 | */ | 383 | */ |
382 | u32 rxrpc_kernel_check_life(const struct socket *sock, | 384 | bool rxrpc_kernel_check_life(const struct socket *sock, |
383 | const struct rxrpc_call *call) | 385 | const struct rxrpc_call *call, |
386 | u32 *_life) | ||
384 | { | 387 | { |
385 | return call->acks_latest; | 388 | *_life = call->acks_latest; |
389 | return call->state != RXRPC_CALL_COMPLETE; | ||
386 | } | 390 | } |
387 | EXPORT_SYMBOL(rxrpc_kernel_check_life); | 391 | EXPORT_SYMBOL(rxrpc_kernel_check_life); |
388 | 392 | ||