rxrpc: Fix conn expiry timers
Fix the rxrpc connection expiry timers so that connections for closed AF_RXRPC sockets get deleted in a more timely fashion, freeing up the transport UDP port much more quickly. (1) Replace the delayed work items with work items plus timers so that timer_reduce() can be used to shorten them and so that the timer doesn't requeue the work item if the net namespace is dead. (2) Don't use queue_delayed_work() as that won't alter the timeout if the timer is already running. (3) Don't rearm the timers if the network namespace is dead. Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
@@ -14,6 +14,24 @@
|
||||
|
||||
unsigned int rxrpc_net_id;
|
||||
|
||||
static void rxrpc_client_conn_reap_timeout(struct timer_list *timer)
|
||||
{
|
||||
struct rxrpc_net *rxnet =
|
||||
container_of(timer, struct rxrpc_net, client_conn_reap_timer);
|
||||
|
||||
if (rxnet->live)
|
||||
rxrpc_queue_work(&rxnet->client_conn_reaper);
|
||||
}
|
||||
|
||||
static void rxrpc_service_conn_reap_timeout(struct timer_list *timer)
|
||||
{
|
||||
struct rxrpc_net *rxnet =
|
||||
container_of(timer, struct rxrpc_net, service_conn_reap_timer);
|
||||
|
||||
if (rxnet->live)
|
||||
rxrpc_queue_work(&rxnet->service_conn_reaper);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialise a per-network namespace record.
|
||||
*/
|
||||
@@ -32,8 +50,10 @@ static __net_init int rxrpc_init_net(struct net *net)
|
||||
INIT_LIST_HEAD(&rxnet->conn_proc_list);
|
||||
INIT_LIST_HEAD(&rxnet->service_conns);
|
||||
rwlock_init(&rxnet->conn_lock);
|
||||
INIT_DELAYED_WORK(&rxnet->service_conn_reaper,
|
||||
rxrpc_service_connection_reaper);
|
||||
INIT_WORK(&rxnet->service_conn_reaper,
|
||||
rxrpc_service_connection_reaper);
|
||||
timer_setup(&rxnet->service_conn_reap_timer,
|
||||
rxrpc_service_conn_reap_timeout, 0);
|
||||
|
||||
rxnet->nr_client_conns = 0;
|
||||
rxnet->nr_active_client_conns = 0;
|
||||
@@ -43,8 +63,10 @@ static __net_init int rxrpc_init_net(struct net *net)
|
||||
INIT_LIST_HEAD(&rxnet->waiting_client_conns);
|
||||
INIT_LIST_HEAD(&rxnet->active_client_conns);
|
||||
INIT_LIST_HEAD(&rxnet->idle_client_conns);
|
||||
INIT_DELAYED_WORK(&rxnet->client_conn_reaper,
|
||||
rxrpc_discard_expired_client_conns);
|
||||
INIT_WORK(&rxnet->client_conn_reaper,
|
||||
rxrpc_discard_expired_client_conns);
|
||||
timer_setup(&rxnet->client_conn_reap_timer,
|
||||
rxrpc_client_conn_reap_timeout, 0);
|
||||
|
||||
INIT_LIST_HEAD(&rxnet->local_endpoints);
|
||||
mutex_init(&rxnet->local_mutex);
|
||||
|
Reference in New Issue
Block a user