summaryrefslogtreecommitdiffstats
path: root/net/rxrpc
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-05-16 08:50:31 -0400
committerDavid Howells <dhowells@redhat.com>2019-05-16 10:48:30 -0400
commitbbd172e31696709b58eb492fafb574985b778326 (patch)
tree5a215213707da75e8cb0059c5af46d7b438974fb /net/rxrpc
parent51eba99970797229b3ac8527193171adea5222ed (diff)
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/rxrpc')
-rw-r--r--net/rxrpc/af_rxrpc.c25
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(
443} 443}
444EXPORT_SYMBOL(rxrpc_kernel_new_call_notification); 444EXPORT_SYMBOL(rxrpc_kernel_new_call_notification);
445 445
446/**
447 * rxrpc_kernel_set_max_life - Set maximum lifespan on a call
448 * @sock: The socket the call is on
449 * @call: The call to configure
450 * @hard_timeout: The maximum lifespan of the call in jiffies
451 *
452 * Set the maximum lifespan of a call. The call will end with ETIME or
453 * ETIMEDOUT if it takes longer than this.
454 */
455void rxrpc_kernel_set_max_life(struct socket *sock, struct rxrpc_call *call,
456 unsigned long hard_timeout)
457{
458 unsigned long now;
459
460 mutex_lock(&call->user_mutex);
461
462 now = jiffies;
463 hard_timeout += now;
464 WRITE_ONCE(call->expect_term_by, hard_timeout);
465 rxrpc_reduce_call_timer(call, hard_timeout, now, rxrpc_timer_set_for_hard);
466
467 mutex_unlock(&call->user_mutex);
468}
469EXPORT_SYMBOL(rxrpc_kernel_set_max_life);
470
446/* 471/*
447 * connect an RxRPC socket 472 * connect an RxRPC socket
448 * - this just targets it at a specific destination; no actual connection 473 * - this just targets it at a specific destination; no actual connection