| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* rxrpc network namespace handling. |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (C) 2017 Red Hat, Inc. All Rights Reserved. |
|---|
| 4 | 5 | * 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. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/proc_fs.h> |
|---|
| .. | .. |
|---|
| 66 | 62 | timer_setup(&rxnet->service_conn_reap_timer, |
|---|
| 67 | 63 | rxrpc_service_conn_reap_timeout, 0); |
|---|
| 68 | 64 | |
|---|
| 69 | | - rxnet->nr_client_conns = 0; |
|---|
| 70 | | - rxnet->nr_active_client_conns = 0; |
|---|
| 65 | + atomic_set(&rxnet->nr_client_conns, 0); |
|---|
| 71 | 66 | rxnet->kill_all_client_conns = false; |
|---|
| 72 | 67 | spin_lock_init(&rxnet->client_conn_cache_lock); |
|---|
| 73 | 68 | spin_lock_init(&rxnet->client_conn_discard_lock); |
|---|
| 74 | | - INIT_LIST_HEAD(&rxnet->waiting_client_conns); |
|---|
| 75 | | - INIT_LIST_HEAD(&rxnet->active_client_conns); |
|---|
| 76 | 69 | INIT_LIST_HEAD(&rxnet->idle_client_conns); |
|---|
| 77 | 70 | INIT_WORK(&rxnet->client_conn_reaper, |
|---|
| 78 | 71 | rxrpc_discard_expired_client_conns); |
|---|
| 79 | 72 | timer_setup(&rxnet->client_conn_reap_timer, |
|---|
| 80 | 73 | rxrpc_client_conn_reap_timeout, 0); |
|---|
| 81 | 74 | |
|---|
| 82 | | - INIT_LIST_HEAD(&rxnet->local_endpoints); |
|---|
| 75 | + INIT_HLIST_HEAD(&rxnet->local_endpoints); |
|---|
| 83 | 76 | mutex_init(&rxnet->local_mutex); |
|---|
| 84 | 77 | |
|---|
| 85 | 78 | hash_init(rxnet->peer_hash); |
|---|
| .. | .. |
|---|
| 102 | 95 | proc_create_net("conns", 0444, rxnet->proc_net, |
|---|
| 103 | 96 | &rxrpc_connection_seq_ops, |
|---|
| 104 | 97 | 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)); |
|---|
| 105 | 104 | return 0; |
|---|
| 106 | 105 | |
|---|
| 107 | 106 | err_proc: |
|---|
| .. | .. |
|---|
| 119 | 118 | rxnet->live = false; |
|---|
| 120 | 119 | del_timer_sync(&rxnet->peer_keepalive_timer); |
|---|
| 121 | 120 | 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); |
|---|
| 122 | 123 | rxrpc_destroy_all_calls(rxnet); |
|---|
| 123 | 124 | rxrpc_destroy_all_connections(rxnet); |
|---|
| 124 | 125 | rxrpc_destroy_all_peers(rxnet); |
|---|