mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 07:10:27 +00:00
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>
This commit is contained in:
parent
51eba99970
commit
bbd172e316
@ -1056,6 +1056,16 @@ The kernel interface functions are as follows:
|
|||||||
This value can be used to determine if the remote client has been
|
This value can be used to determine if the remote client has been
|
||||||
restarted as it shouldn't change otherwise.
|
restarted as it shouldn't change otherwise.
|
||||||
|
|
||||||
|
(*) Set the maxmimum lifespan on a call.
|
||||||
|
|
||||||
|
void rxrpc_kernel_set_max_life(struct socket *sock,
|
||||||
|
struct rxrpc_call *call,
|
||||||
|
unsigned long hard_timeout)
|
||||||
|
|
||||||
|
This sets the maximum lifespan on a call to hard_timeout (which is in
|
||||||
|
jiffies). In the event of the timeout occurring, the call will be
|
||||||
|
aborted and -ETIME or -ETIMEDOUT will be returned.
|
||||||
|
|
||||||
|
|
||||||
=======================
|
=======================
|
||||||
CONFIGURABLE PARAMETERS
|
CONFIGURABLE PARAMETERS
|
||||||
|
@ -68,5 +68,7 @@ u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
|
|||||||
bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
|
bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
|
||||||
ktime_t *);
|
ktime_t *);
|
||||||
bool rxrpc_kernel_call_is_complete(struct rxrpc_call *);
|
bool rxrpc_kernel_call_is_complete(struct rxrpc_call *);
|
||||||
|
void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
|
||||||
|
unsigned long);
|
||||||
|
|
||||||
#endif /* _NET_RXRPC_H */
|
#endif /* _NET_RXRPC_H */
|
||||||
|
@ -443,6 +443,31 @@ void rxrpc_kernel_new_call_notification(
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(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
|
* connect an RxRPC socket
|
||||||
* - this just targets it at a specific destination; no actual connection
|
* - this just targets it at a specific destination; no actual connection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user