Commit 4d028b2c authored by David Howells's avatar David Howells

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: default avatarDavid Howells <dhowells@redhat.com>
parent df5d8bf7
...@@ -310,6 +310,7 @@ struct rxrpc_connection { ...@@ -310,6 +310,7 @@ struct rxrpc_connection {
struct rb_node client_node; /* Node in local->client_conns */ struct rb_node client_node; /* Node in local->client_conns */
struct rb_node service_node; /* Node in peer->service_conns */ struct rb_node service_node; /* Node in peer->service_conns */
}; };
struct list_head proc_link; /* link in procfs list */
struct list_head link; /* link in master connection list */ struct list_head link; /* link in master connection list */
struct sk_buff_head rx_queue; /* received conn-level packets */ struct sk_buff_head rx_queue; /* received conn-level packets */
const struct rxrpc_security *security; /* applied security module */ const struct rxrpc_security *security; /* applied security module */
...@@ -564,6 +565,7 @@ void rxrpc_reject_packets(struct rxrpc_local *); ...@@ -564,6 +565,7 @@ void rxrpc_reject_packets(struct rxrpc_local *);
*/ */
extern unsigned int rxrpc_connection_expiry; extern unsigned int rxrpc_connection_expiry;
extern struct list_head rxrpc_connections; extern struct list_head rxrpc_connections;
extern struct list_head rxrpc_connection_proc_list;
extern rwlock_t rxrpc_connection_lock; extern rwlock_t rxrpc_connection_lock;
int rxrpc_extract_addr_from_skb(struct sockaddr_rxrpc *, struct sk_buff *); int rxrpc_extract_addr_from_skb(struct sockaddr_rxrpc *, struct sk_buff *);
......
...@@ -149,6 +149,7 @@ rxrpc_alloc_client_connection(struct rxrpc_conn_parameters *cp, gfp_t gfp) ...@@ -149,6 +149,7 @@ rxrpc_alloc_client_connection(struct rxrpc_conn_parameters *cp, gfp_t gfp)
write_lock(&rxrpc_connection_lock); write_lock(&rxrpc_connection_lock);
list_add_tail(&conn->link, &rxrpc_connections); list_add_tail(&conn->link, &rxrpc_connections);
list_add_tail(&conn->proc_link, &rxrpc_connection_proc_list);
write_unlock(&rxrpc_connection_lock); write_unlock(&rxrpc_connection_lock);
/* We steal the caller's peer ref. */ /* We steal the caller's peer ref. */
......
...@@ -27,6 +27,7 @@ unsigned int rxrpc_connection_expiry = 10 * 60; ...@@ -27,6 +27,7 @@ unsigned int rxrpc_connection_expiry = 10 * 60;
static void rxrpc_connection_reaper(struct work_struct *work); static void rxrpc_connection_reaper(struct work_struct *work);
LIST_HEAD(rxrpc_connections); LIST_HEAD(rxrpc_connections);
LIST_HEAD(rxrpc_connection_proc_list);
DEFINE_RWLOCK(rxrpc_connection_lock); DEFINE_RWLOCK(rxrpc_connection_lock);
static DECLARE_DELAYED_WORK(rxrpc_connection_reap, rxrpc_connection_reaper); static DECLARE_DELAYED_WORK(rxrpc_connection_reap, rxrpc_connection_reaper);
...@@ -44,6 +45,7 @@ struct rxrpc_connection *rxrpc_alloc_connection(gfp_t gfp) ...@@ -44,6 +45,7 @@ struct rxrpc_connection *rxrpc_alloc_connection(gfp_t gfp)
spin_lock_init(&conn->channel_lock); spin_lock_init(&conn->channel_lock);
init_waitqueue_head(&conn->channel_wq); init_waitqueue_head(&conn->channel_wq);
INIT_WORK(&conn->processor, &rxrpc_process_connection); INIT_WORK(&conn->processor, &rxrpc_process_connection);
INIT_LIST_HEAD(&conn->proc_link);
INIT_LIST_HEAD(&conn->link); INIT_LIST_HEAD(&conn->link);
skb_queue_head_init(&conn->rx_queue); skb_queue_head_init(&conn->rx_queue);
conn->security = &rxrpc_no_security; conn->security = &rxrpc_no_security;
...@@ -283,6 +285,7 @@ static void rxrpc_connection_reaper(struct work_struct *work) ...@@ -283,6 +285,7 @@ static void rxrpc_connection_reaper(struct work_struct *work)
rxrpc_unpublish_service_conn(conn); rxrpc_unpublish_service_conn(conn);
list_move_tail(&conn->link, &graveyard); list_move_tail(&conn->link, &graveyard);
list_del_init(&conn->proc_link);
} }
write_unlock(&rxrpc_connection_lock); write_unlock(&rxrpc_connection_lock);
......
...@@ -187,6 +187,7 @@ struct rxrpc_connection *rxrpc_incoming_connection(struct rxrpc_local *local, ...@@ -187,6 +187,7 @@ struct rxrpc_connection *rxrpc_incoming_connection(struct rxrpc_local *local,
write_lock(&rxrpc_connection_lock); write_lock(&rxrpc_connection_lock);
list_add_tail(&conn->link, &rxrpc_connections); list_add_tail(&conn->link, &rxrpc_connections);
list_add_tail(&conn->proc_link, &rxrpc_connection_proc_list);
write_unlock(&rxrpc_connection_lock); write_unlock(&rxrpc_connection_lock);
/* Make the connection a target for incoming packets. */ /* Make the connection a target for incoming packets. */
......
...@@ -126,13 +126,13 @@ const struct file_operations rxrpc_call_seq_fops = { ...@@ -126,13 +126,13 @@ const struct file_operations rxrpc_call_seq_fops = {
static void *rxrpc_connection_seq_start(struct seq_file *seq, loff_t *_pos) static void *rxrpc_connection_seq_start(struct seq_file *seq, loff_t *_pos)
{ {
read_lock(&rxrpc_connection_lock); read_lock(&rxrpc_connection_lock);
return seq_list_start_head(&rxrpc_connections, *_pos); return seq_list_start_head(&rxrpc_connection_proc_list, *_pos);
} }
static void *rxrpc_connection_seq_next(struct seq_file *seq, void *v, static void *rxrpc_connection_seq_next(struct seq_file *seq, void *v,
loff_t *pos) loff_t *pos)
{ {
return seq_list_next(v, &rxrpc_connections, pos); return seq_list_next(v, &rxrpc_connection_proc_list, pos);
} }
static void rxrpc_connection_seq_stop(struct seq_file *seq, void *v) static 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,7 +145,7 @@ static int rxrpc_connection_seq_show(struct seq_file *seq, void *v)
struct rxrpc_connection *conn; struct rxrpc_connection *conn;
char lbuff[4 + 4 + 4 + 4 + 5 + 1], rbuff[4 + 4 + 4 + 4 + 5 + 1]; char lbuff[4 + 4 + 4 + 4 + 5 + 1], rbuff[4 + 4 + 4 + 4 + 5 + 1];
if (v == &rxrpc_connections) { if (v == &rxrpc_connection_proc_list) {
seq_puts(seq, seq_puts(seq,
"Proto Local Remote " "Proto Local Remote "
" SvID ConnID End Use State Key " " SvID ConnID End Use State Key "
...@@ -154,7 +154,7 @@ static int rxrpc_connection_seq_show(struct seq_file *seq, void *v) ...@@ -154,7 +154,7 @@ static int rxrpc_connection_seq_show(struct seq_file *seq, void *v)
return 0; return 0;
} }
conn = list_entry(v, struct rxrpc_connection, link); conn = list_entry(v, struct rxrpc_connection, proc_link);
sprintf(lbuff, "%pI4:%u", sprintf(lbuff, "%pI4:%u",
&conn->params.local->srx.transport.sin.sin_addr, &conn->params.local->srx.transport.sin.sin_addr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment