diff options
Diffstat (limited to 'net/rxrpc/conn_client.c')
-rw-r--r-- | net/rxrpc/conn_client.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c index 9344a8416ceb..226bc910e556 100644 --- a/net/rxrpc/conn_client.c +++ b/net/rxrpc/conn_client.c | |||
@@ -721,7 +721,6 @@ void rxrpc_disconnect_client_call(struct rxrpc_call *call) | |||
721 | } | 721 | } |
722 | 722 | ||
723 | ASSERTCMP(rcu_access_pointer(chan->call), ==, call); | 723 | ASSERTCMP(rcu_access_pointer(chan->call), ==, call); |
724 | ASSERTCMP(atomic_read(&conn->usage), >=, 2); | ||
725 | 724 | ||
726 | /* If a client call was exposed to the world, we save the result for | 725 | /* If a client call was exposed to the world, we save the result for |
727 | * retransmission. | 726 | * retransmission. |
@@ -818,7 +817,7 @@ idle_connection: | |||
818 | static struct rxrpc_connection * | 817 | static struct rxrpc_connection * |
819 | rxrpc_put_one_client_conn(struct rxrpc_connection *conn) | 818 | rxrpc_put_one_client_conn(struct rxrpc_connection *conn) |
820 | { | 819 | { |
821 | struct rxrpc_connection *next; | 820 | struct rxrpc_connection *next = NULL; |
822 | struct rxrpc_local *local = conn->params.local; | 821 | struct rxrpc_local *local = conn->params.local; |
823 | unsigned int nr_conns; | 822 | unsigned int nr_conns; |
824 | 823 | ||
@@ -834,24 +833,22 @@ rxrpc_put_one_client_conn(struct rxrpc_connection *conn) | |||
834 | 833 | ||
835 | ASSERTCMP(conn->cache_state, ==, RXRPC_CONN_CLIENT_INACTIVE); | 834 | ASSERTCMP(conn->cache_state, ==, RXRPC_CONN_CLIENT_INACTIVE); |
836 | 835 | ||
837 | if (!test_bit(RXRPC_CONN_COUNTED, &conn->flags)) | 836 | if (test_bit(RXRPC_CONN_COUNTED, &conn->flags)) { |
838 | return NULL; | 837 | spin_lock(&rxrpc_client_conn_cache_lock); |
839 | 838 | nr_conns = --rxrpc_nr_client_conns; | |
840 | spin_lock(&rxrpc_client_conn_cache_lock); | 839 | |
841 | nr_conns = --rxrpc_nr_client_conns; | 840 | if (nr_conns < rxrpc_max_client_connections && |
841 | !list_empty(&rxrpc_waiting_client_conns)) { | ||
842 | next = list_entry(rxrpc_waiting_client_conns.next, | ||
843 | struct rxrpc_connection, cache_link); | ||
844 | rxrpc_get_connection(next); | ||
845 | rxrpc_activate_conn(next); | ||
846 | } | ||
842 | 847 | ||
843 | next = NULL; | 848 | spin_unlock(&rxrpc_client_conn_cache_lock); |
844 | if (nr_conns < rxrpc_max_client_connections && | ||
845 | !list_empty(&rxrpc_waiting_client_conns)) { | ||
846 | next = list_entry(rxrpc_waiting_client_conns.next, | ||
847 | struct rxrpc_connection, cache_link); | ||
848 | rxrpc_get_connection(next); | ||
849 | rxrpc_activate_conn(next); | ||
850 | } | 849 | } |
851 | 850 | ||
852 | spin_unlock(&rxrpc_client_conn_cache_lock); | ||
853 | rxrpc_kill_connection(conn); | 851 | rxrpc_kill_connection(conn); |
854 | |||
855 | if (next) | 852 | if (next) |
856 | rxrpc_activate_channels(next); | 853 | rxrpc_activate_channels(next); |
857 | 854 | ||