diff options
author | David Howells <dhowells@redhat.com> | 2019-05-16 13:50:31 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2019-05-16 15:48:30 +0100 |
commit | bbd172e31696709b58eb492fafb574985b778326 (patch) | |
tree | 5a215213707da75e8cb0059c5af46d7b438974fb /net | |
parent | 51eba99970797229b3ac8527193171adea5222ed (diff) | |
download | linux-stable-bbd172e31696709b58eb492fafb574985b778326.tar.gz linux-stable-bbd172e31696709b58eb492fafb574985b778326.tar.bz2 linux-stable-bbd172e31696709b58eb492fafb574985b778326.zip |
rxrpc: Provide kernel interface to set max lifespan on a call
Provide an interface to set max lifespan on a call from inside of the
kernel without having to call kernel_sendmsg().
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/rxrpc/af_rxrpc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index ae8c5d7f3bf1..213935fbbbf7 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c @@ -443,6 +443,31 @@ void rxrpc_kernel_new_call_notification( } EXPORT_SYMBOL(rxrpc_kernel_new_call_notification); +/** + * rxrpc_kernel_set_max_life - Set maximum lifespan on a call + * @sock: The socket the call is on + * @call: The call to configure + * @hard_timeout: The maximum lifespan of the call in jiffies + * + * Set the maximum lifespan of a call. The call will end with ETIME or + * ETIMEDOUT if it takes longer than this. + */ +void rxrpc_kernel_set_max_life(struct socket *sock, struct rxrpc_call *call, + unsigned long hard_timeout) +{ + unsigned long now; + + mutex_lock(&call->user_mutex); + + now = jiffies; + hard_timeout += now; + WRITE_ONCE(call->expect_term_by, hard_timeout); + rxrpc_reduce_call_timer(call, hard_timeout, now, rxrpc_timer_set_for_hard); + + mutex_unlock(&call->user_mutex); +} +EXPORT_SYMBOL(rxrpc_kernel_set_max_life); + /* * connect an RxRPC socket * - this just targets it at a specific destination; no actual connection |