aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-08-24 02:30:52 -0400
committerDavid Howells <dhowells@redhat.com>2016-08-24 10:17:14 -0400
commit4d028b2c82991e2f9ae89ad90aeaaeb713495043 (patch)
tree6c94c0a36600d69bb4ed9928372d08f952529f93
parentdf5d8bf70f64a2ee34234553eb215418dbc4c8f3 (diff)
rxrpc: Dup the main conn list for the proc interface
The main connection list is used for two independent purposes: primarily it is used to find connections to reap and secondarily it is used to list connections in procfs. Split the procfs list out from the reap list. This allows us to stop using the reap list for client connections when they acquire a separate management strategy from service collections. The client connections will not be on a management single list, and sometimes won't be on a management list at all. This doesn't leave them floating, however, as they will also be on an rb-tree rooted on the socket so that the socket can find them to dispatch calls. Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--net/rxrpc/ar-internal.h2
-rw-r--r--net/rxrpc/conn_client.c1
-rw-r--r--net/rxrpc/conn_object.c3
-rw-r--r--net/rxrpc/conn_service.c1
-rw-r--r--net/rxrpc/proc.c8
5 files changed, 11 insertions, 4 deletions
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 5292bf0bce52..2efbfba87cbe 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -310,6 +310,7 @@ struct rxrpc_connection {
310 struct rb_node client_node; /* Node in local->client_conns */ 310 struct rb_node client_node; /* Node in local->client_conns */
311 struct rb_node service_node; /* Node in peer->service_conns */ 311 struct rb_node service_node; /* Node in peer->service_conns */
312 }; 312 };
313 struct list_head proc_link; /* link in procfs list */
313 struct list_head link; /* link in master connection list */ 314 struct list_head link; /* link in master connection list */
314 struct sk_buff_head rx_queue; /* received conn-level packets */ 315 struct sk_buff_head rx_queue; /* received conn-level packets */
315 const struct rxrpc_security *security; /* applied security module */ 316 const struct rxrpc_security *security; /* applied security module */
@@ -564,6 +565,7 @@ void rxrpc_reject_packets(struct rxrpc_local *);
564 */ 565 */
565extern unsigned int rxrpc_connection_expiry; 566extern unsigned int rxrpc_connection_expiry;
566extern struct list_head rxrpc_connections; 567extern struct list_head rxrpc_connections;
568extern struct list_head rxrpc_connection_proc_list;
567extern rwlock_t rxrpc_connection_lock; 569extern rwlock_t rxrpc_connection_lock;
568 570
569int rxrpc_extract_addr_from_skb(struct sockaddr_rxrpc *, struct sk_buff *); 571int rxrpc_extract_addr_from_skb(struct sockaddr_rxrpc *, struct sk_buff *);
diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c
index 2d43c99e5360..6e1099ed1dbd 100644
--- a/net/rxrpc/conn_client.c
+++ b/net/rxrpc/conn_client.c
@@ -149,6 +149,7 @@ rxrpc_alloc_client_connection(struct rxrpc_conn_parameters *cp, gfp_t gfp)
149 149
150 write_lock(&rxrpc_connection_lock); 150 write_lock(&rxrpc_connection_lock);
151 list_add_tail(&conn->link, &rxrpc_connections); 151 list_add_tail(&conn->link, &rxrpc_connections);
152 list_add_tail(&conn->proc_link, &rxrpc_connection_proc_list);
152 write_unlock(&rxrpc_connection_lock); 153 write_unlock(&rxrpc_connection_lock);
153 154
154 /* We steal the caller's peer ref. */ 155 /* We steal the caller's peer ref. */
diff --git a/net/rxrpc/conn_object.c b/net/rxrpc/conn_object.c
index b4af37ebb112..afc2d83d5995 100644
--- a/net/rxrpc/conn_object.c
+++ b/net/rxrpc/conn_object.c
@@ -27,6 +27,7 @@ unsigned int rxrpc_connection_expiry = 10 * 60;
27static void rxrpc_connection_reaper(struct work_struct *work); 27static void rxrpc_connection_reaper(struct work_struct *work);
28 28
29LIST_HEAD(rxrpc_connections); 29LIST_HEAD(rxrpc_connections);
30LIST_HEAD(rxrpc_connection_proc_list);
30DEFINE_RWLOCK(rxrpc_connection_lock); 31DEFINE_RWLOCK(rxrpc_connection_lock);
31static DECLARE_DELAYED_WORK(rxrpc_connection_reap, rxrpc_connection_reaper); 32static DECLARE_DELAYED_WORK(rxrpc_connection_reap, rxrpc_connection_reaper);
32 33
@@ -44,6 +45,7 @@ struct rxrpc_connection *rxrpc_alloc_connection(gfp_t gfp)
44 spin_lock_init(&conn->channel_lock); 45 spin_lock_init(&conn->channel_lock);
45 init_waitqueue_head(&conn->channel_wq); 46 init_waitqueue_head(&conn->channel_wq);
46 INIT_WORK(&conn->processor, &rxrpc_process_connection); 47 INIT_WORK(&conn->processor, &rxrpc_process_connection);
48 INIT_LIST_HEAD(&conn->proc_link);
47 INIT_LIST_HEAD(&conn->link); 49 INIT_LIST_HEAD(&conn->link);
48 skb_queue_head_init(&conn->rx_queue); 50 skb_queue_head_init(&conn->rx_queue);
49 conn->security = &rxrpc_no_security; 51 conn->security = &rxrpc_no_security;
@@ -283,6 +285,7 @@ static void rxrpc_connection_reaper(struct work_struct *work)
283 rxrpc_unpublish_service_conn(conn); 285 rxrpc_unpublish_service_conn(conn);
284 286
285 list_move_tail(&conn->link, &graveyard); 287 list_move_tail(&conn->link, &graveyard);
288 list_del_init(&conn->proc_link);
286 } 289 }
287 write_unlock(&rxrpc_connection_lock); 290 write_unlock(&rxrpc_connection_lock);
288 291
diff --git a/net/rxrpc/conn_service.c b/net/rxrpc/conn_service.c
index fd9027ccba8f..6ad6ae926cc3 100644
--- a/net/rxrpc/conn_service.c
+++ b/net/rxrpc/conn_service.c
@@ -187,6 +187,7 @@ struct rxrpc_connection *rxrpc_incoming_connection(struct rxrpc_local *local,
187 187
188 write_lock(&rxrpc_connection_lock); 188 write_lock(&rxrpc_connection_lock);
189 list_add_tail(&conn->link, &rxrpc_connections); 189 list_add_tail(&conn->link, &rxrpc_connections);
190 list_add_tail(&conn->proc_link, &rxrpc_connection_proc_list);
190 write_unlock(&rxrpc_connection_lock); 191 write_unlock(&rxrpc_connection_lock);
191 192
192 /* Make the connection a target for incoming packets. */ 193 /* Make the connection a target for incoming packets. */
diff --git a/net/rxrpc/proc.c b/net/rxrpc/proc.c
index 53872631a66d..060fb4892c39 100644
--- a/net/rxrpc/proc.c
+++ b/net/rxrpc/proc.c
@@ -126,13 +126,13 @@ const struct file_operations rxrpc_call_seq_fops = {
126static void *rxrpc_connection_seq_start(struct seq_file *seq, loff_t *_pos) 126static void *rxrpc_connection_seq_start(struct seq_file *seq, loff_t *_pos)
127{ 127{
128 read_lock(&rxrpc_connection_lock); 128 read_lock(&rxrpc_connection_lock);
129 return seq_list_start_head(&rxrpc_connections, *_pos); 129 return seq_list_start_head(&rxrpc_connection_proc_list, *_pos);
130} 130}
131 131
132static void *rxrpc_connection_seq_next(struct seq_file *seq, void *v, 132static void *rxrpc_connection_seq_next(struct seq_file *seq, void *v,
133 loff_t *pos) 133 loff_t *pos)
134{ 134{
135 return seq_list_next(v, &rxrpc_connections, pos); 135 return seq_list_next(v, &rxrpc_connection_proc_list, pos);
136} 136}
137 137
138static void rxrpc_connection_seq_stop(struct seq_file *seq, void *v) 138static void rxrpc_connection_seq_stop(struct seq_file *seq, void *v)
@@ -145,7 +145,7 @@ static int rxrpc_connection_seq_show(struct seq_file *seq, void *v)
145 struct rxrpc_connection *conn; 145 struct rxrpc_connection *conn;
146 char lbuff[4 + 4 + 4 + 4 + 5 + 1], rbuff[4 + 4 + 4 + 4 + 5 + 1]; 146 char lbuff[4 + 4 + 4 + 4 + 5 + 1], rbuff[4 + 4 + 4 + 4 + 5 + 1];
147 147
148 if (v == &rxrpc_connections) { 148 if (v == &rxrpc_connection_proc_list) {
149 seq_puts(seq, 149 seq_puts(seq,
150 "Proto Local Remote " 150 "Proto Local Remote "
151 " SvID ConnID End Use State Key " 151 " SvID ConnID End Use State Key "
@@ -154,7 +154,7 @@ static int rxrpc_connection_seq_show(struct seq_file *seq, void *v)
154 return 0; 154 return 0;
155 } 155 }
156 156
157 conn = list_entry(v, struct rxrpc_connection, link); 157 conn = list_entry(v, struct rxrpc_connection, proc_link);
158 158
159 sprintf(lbuff, "%pI4:%u", 159 sprintf(lbuff, "%pI4:%u",
160 &conn->params.local->srx.transport.sin.sin_addr, 160 &conn->params.local->srx.transport.sin.sin_addr,