Commit e0d9ae69 authored by David S. Miller's avatar David S. Miller

Merge tag 'rxrpc-next-20200914' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

David Howells says:

====================
rxrpc: Fixes for the connection manager rewrite

Here are some fixes for the connection manager rewrite:

 (1) Fix a goto to the wrong place in error handling.

 (2) Fix a missing NULL pointer check.

 (3) The stored allocation error needs to be stored signed.

 (4) Fix a leak of connection bundle when clearing connections due to
     net namespace exit.

 (5) Fix an overget of the bundle when setting up a new client conn.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 33acd755 f1b44974
...@@ -579,7 +579,7 @@ TRACE_EVENT(rxrpc_client, ...@@ -579,7 +579,7 @@ TRACE_EVENT(rxrpc_client,
__entry->channel = channel; __entry->channel = channel;
__entry->usage = conn ? atomic_read(&conn->usage) : -2; __entry->usage = conn ? atomic_read(&conn->usage) : -2;
__entry->op = op; __entry->op = op;
__entry->cid = conn->proto.cid; __entry->cid = conn ? conn->proto.cid : 0;
), ),
TP_printk("C=%08x h=%2d %s i=%08x u=%d", TP_printk("C=%08x h=%2d %s i=%08x u=%d",
......
...@@ -395,7 +395,7 @@ struct rxrpc_bundle { ...@@ -395,7 +395,7 @@ struct rxrpc_bundle {
unsigned int debug_id; unsigned int debug_id;
bool try_upgrade; /* True if the bundle is attempting upgrade */ bool try_upgrade; /* True if the bundle is attempting upgrade */
bool alloc_conn; /* True if someone's getting a conn */ bool alloc_conn; /* True if someone's getting a conn */
unsigned short alloc_error; /* Error from last conn allocation */ short alloc_error; /* Error from last conn allocation */
spinlock_t channel_lock; spinlock_t channel_lock;
struct rb_node local_node; /* Node in local->client_conns */ struct rb_node local_node; /* Node in local->client_conns */
struct list_head waiting_calls; /* Calls waiting for channels */ struct list_head waiting_calls; /* Calls waiting for channels */
......
...@@ -433,7 +433,6 @@ static void rxrpc_add_conn_to_bundle(struct rxrpc_bundle *bundle, gfp_t gfp) ...@@ -433,7 +433,6 @@ static void rxrpc_add_conn_to_bundle(struct rxrpc_bundle *bundle, gfp_t gfp)
if (!rxrpc_may_reuse_conn(old)) { if (!rxrpc_may_reuse_conn(old)) {
if (old) if (old)
trace_rxrpc_client(old, -1, rxrpc_client_replace); trace_rxrpc_client(old, -1, rxrpc_client_replace);
candidate->bundle = rxrpc_get_bundle(bundle);
candidate->bundle_shift = shift; candidate->bundle_shift = shift;
bundle->conns[i] = candidate; bundle->conns[i] = candidate;
for (j = 0; j < RXRPC_MAXCALLS; j++) for (j = 0; j < RXRPC_MAXCALLS; j++)
...@@ -724,8 +723,9 @@ int rxrpc_connect_call(struct rxrpc_sock *rx, ...@@ -724,8 +723,9 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,
/* Paired with the write barrier in rxrpc_activate_one_channel(). */ /* Paired with the write barrier in rxrpc_activate_one_channel(). */
smp_rmb(); smp_rmb();
out: out_put_bundle:
rxrpc_put_bundle(bundle); rxrpc_put_bundle(bundle);
out:
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
...@@ -742,7 +742,7 @@ int rxrpc_connect_call(struct rxrpc_sock *rx, ...@@ -742,7 +742,7 @@ int rxrpc_connect_call(struct rxrpc_sock *rx,
trace_rxrpc_client(call->conn, ret, rxrpc_client_chan_wait_failed); trace_rxrpc_client(call->conn, ret, rxrpc_client_chan_wait_failed);
rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, 0, ret); rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR, 0, ret);
rxrpc_disconnect_client_call(bundle, call); rxrpc_disconnect_client_call(bundle, call);
goto out; goto out_put_bundle;
} }
/* /*
...@@ -1111,6 +1111,7 @@ void rxrpc_clean_up_local_conns(struct rxrpc_local *local) ...@@ -1111,6 +1111,7 @@ void rxrpc_clean_up_local_conns(struct rxrpc_local *local)
conn = list_entry(graveyard.next, conn = list_entry(graveyard.next,
struct rxrpc_connection, cache_link); struct rxrpc_connection, cache_link);
list_del_init(&conn->cache_link); list_del_init(&conn->cache_link);
rxrpc_unbundle_conn(conn);
rxrpc_put_connection(conn); rxrpc_put_connection(conn);
} }
......
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