hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/net/rxrpc/net_ns.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* rxrpc network namespace handling.
23 *
34 * Copyright (C) 2017 Red Hat, Inc. All Rights Reserved.
45 * Written by David Howells (dhowells@redhat.com)
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public Licence
8
- * as published by the Free Software Foundation; either version
9
- * 2 of the Licence, or (at your option) any later version.
106 */
117
128 #include <linux/proc_fs.h>
....@@ -66,20 +62,17 @@
6662 timer_setup(&rxnet->service_conn_reap_timer,
6763 rxrpc_service_conn_reap_timeout, 0);
6864
69
- rxnet->nr_client_conns = 0;
70
- rxnet->nr_active_client_conns = 0;
65
+ atomic_set(&rxnet->nr_client_conns, 0);
7166 rxnet->kill_all_client_conns = false;
7267 spin_lock_init(&rxnet->client_conn_cache_lock);
7368 spin_lock_init(&rxnet->client_conn_discard_lock);
74
- INIT_LIST_HEAD(&rxnet->waiting_client_conns);
75
- INIT_LIST_HEAD(&rxnet->active_client_conns);
7669 INIT_LIST_HEAD(&rxnet->idle_client_conns);
7770 INIT_WORK(&rxnet->client_conn_reaper,
7871 rxrpc_discard_expired_client_conns);
7972 timer_setup(&rxnet->client_conn_reap_timer,
8073 rxrpc_client_conn_reap_timeout, 0);
8174
82
- INIT_LIST_HEAD(&rxnet->local_endpoints);
75
+ INIT_HLIST_HEAD(&rxnet->local_endpoints);
8376 mutex_init(&rxnet->local_mutex);
8477
8578 hash_init(rxnet->peer_hash);
....@@ -102,6 +95,12 @@
10295 proc_create_net("conns", 0444, rxnet->proc_net,
10396 &rxrpc_connection_seq_ops,
10497 sizeof(struct seq_net_private));
98
+ proc_create_net("peers", 0444, rxnet->proc_net,
99
+ &rxrpc_peer_seq_ops,
100
+ sizeof(struct seq_net_private));
101
+ proc_create_net("locals", 0444, rxnet->proc_net,
102
+ &rxrpc_local_seq_ops,
103
+ sizeof(struct seq_net_private));
105104 return 0;
106105
107106 err_proc:
....@@ -119,6 +118,8 @@
119118 rxnet->live = false;
120119 del_timer_sync(&rxnet->peer_keepalive_timer);
121120 cancel_work_sync(&rxnet->peer_keepalive_work);
121
+ /* Remove the timer again as the worker may have restarted it. */
122
+ del_timer_sync(&rxnet->peer_keepalive_timer);
122123 rxrpc_destroy_all_calls(rxnet);
123124 rxrpc_destroy_all_connections(rxnet);
124125 rxrpc_destroy_all_peers(rxnet);