mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
afs: Fix netns teardown to cancel the preallocation charger
Fix the teardown of an afs network namespace to make sure it cancels the
work item that keeps the preallocated rxrpc call/conn/peer queue charged
before incoming calls are disabled (i.e. listen 0).
Also, if net->live is false because the afs netns is being deleted, make
afs_charge_preallocation() skip charging and make afs_rx_new_call() avoid
requeuing the charger.
(This was found by AI review).
Fixes: 00e907127e ("rxrpc: Preallocate peers, conns and calls for incoming service requests")
Reported-by: Simon Horman <horms@kernel.org>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Li Daming <d4n.for.sec@gmail.com>
cc: Ren Wei <n05ec@lzu.edu.cn>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Jeffrey Altman <jaltman@auristor.com>
cc: linux-afs@lists.infradead.org
cc: stable@kernel.org
Link: https://patch.msgid.link/20260609140911.838677-5-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
107a4cb0d4
commit
47694fbc9d
|
|
@ -127,6 +127,7 @@ void afs_close_socket(struct afs_net *net)
|
||||||
{
|
{
|
||||||
_enter("");
|
_enter("");
|
||||||
|
|
||||||
|
cancel_work_sync(&net->charge_preallocation_work);
|
||||||
kernel_listen(net->socket, 0);
|
kernel_listen(net->socket, 0);
|
||||||
flush_workqueue(afs_async_calls);
|
flush_workqueue(afs_async_calls);
|
||||||
|
|
||||||
|
|
@ -742,7 +743,7 @@ void afs_charge_preallocation(struct work_struct *work)
|
||||||
container_of(work, struct afs_net, charge_preallocation_work);
|
container_of(work, struct afs_net, charge_preallocation_work);
|
||||||
struct afs_call *call = net->spare_incoming_call;
|
struct afs_call *call = net->spare_incoming_call;
|
||||||
|
|
||||||
for (;;) {
|
while (READ_ONCE(net->live)) {
|
||||||
if (!call) {
|
if (!call) {
|
||||||
call = afs_alloc_call(net, &afs_RXCMxxxx, GFP_KERNEL);
|
call = afs_alloc_call(net, &afs_RXCMxxxx, GFP_KERNEL);
|
||||||
if (!call)
|
if (!call)
|
||||||
|
|
@ -792,6 +793,7 @@ static void afs_rx_new_call(struct sock *sk, struct rxrpc_call *rxcall,
|
||||||
if (!call->server)
|
if (!call->server)
|
||||||
trace_afs_cm_no_server(call, rxrpc_kernel_remote_srx(call->peer));
|
trace_afs_cm_no_server(call, rxrpc_kernel_remote_srx(call->peer));
|
||||||
|
|
||||||
|
if (net->live)
|
||||||
queue_work(afs_wq, &net->charge_preallocation_work);
|
queue_work(afs_wq, &net->charge_preallocation_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user