]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - net/rxrpc/af_rxrpc.c
rxrpc: Use ktimes for call timeout tracking and set the timer lazily
[thirdparty/kernel/stable.git] / net / rxrpc / af_rxrpc.c
index 465bfe5eb0617b7857626863a5c9dd9386f29e39..5222bc97d192e05e2169dcf5f548fdeb98e6b07b 100644 (file)
@@ -487,7 +487,7 @@ 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
+ * @hard_timeout: The maximum lifespan of the call in ms
  *
  * Set the maximum lifespan of a call.  The call will end with ETIME or
  * ETIMEDOUT if it takes longer than this.
@@ -495,14 +495,14 @@ EXPORT_SYMBOL(rxrpc_kernel_new_call_notification);
 void rxrpc_kernel_set_max_life(struct socket *sock, struct rxrpc_call *call,
                               unsigned long hard_timeout)
 {
-       unsigned long now;
+       ktime_t delay = ms_to_ktime(hard_timeout), expect_term_by;
 
        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);
+       expect_term_by = ktime_add(ktime_get_real(), delay);
+       WRITE_ONCE(call->expect_term_by, expect_term_by);
+       trace_rxrpc_timer_set(call, delay, rxrpc_timer_trace_hard);
+       rxrpc_poke_call(call, rxrpc_call_poke_set_timeout);
 
        mutex_unlock(&call->user_mutex);
 }