Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rxrpc: Fix two connection reaping bugs

Fix two connection reaping bugs:

(1) rxrpc_connection_expiry is in units of seconds, so
rxrpc_disconnect_call() needs to multiply it by HZ when adding it to
jiffies.

(2) rxrpc_client_conn_reap_timeout() should set RXRPC_CLIENT_REAP_TIMER if
local->kill_all_client_conns is clear, not if it is set (in which case
we don't need the timer). Without this, old client connections don't
get cleaned up until the local endpoint is cleaned up.

Fixes: 5040011d073d ("rxrpc: Make the local endpoint hold a ref on a connected call")
Fixes: 0d6bf319bc5a ("rxrpc: Move the client conn cache management to the I/O thread")
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/783911.1698364174@warthog.procyon.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

David Howells and committed by
Jakub Kicinski
61e4a866 74da7792

+2 -2
+1 -1
net/rxrpc/conn_object.c
··· 212 212 conn->idle_timestamp = jiffies; 213 213 if (atomic_dec_and_test(&conn->active)) 214 214 rxrpc_set_service_reap_timer(conn->rxnet, 215 - jiffies + rxrpc_connection_expiry); 215 + jiffies + rxrpc_connection_expiry * HZ); 216 216 } 217 217 218 218 rxrpc_put_call(call, rxrpc_call_put_io_thread);
+1 -1
net/rxrpc/local_object.c
··· 87 87 struct rxrpc_local *local = 88 88 container_of(timer, struct rxrpc_local, client_conn_reap_timer); 89 89 90 - if (local->kill_all_client_conns && 90 + if (!local->kill_all_client_conns && 91 91 test_and_set_bit(RXRPC_CLIENT_CONN_REAP_TIMER, &local->client_conn_flags)) 92 92 rxrpc_wake_up_io_thread(local); 93 93 }