@@ -578,17 +578,17 @@ static void rxrpc_activate_one_channel(struct rxrpc_connection *conn,
578
578
*/
579
579
static void rxrpc_unidle_conn (struct rxrpc_bundle * bundle , struct rxrpc_connection * conn )
580
580
{
581
- struct rxrpc_net * rxnet = bundle -> local -> rxnet ;
581
+ struct rxrpc_local * local = bundle -> local ;
582
582
bool drop_ref ;
583
583
584
584
if (!list_empty (& conn -> cache_link )) {
585
585
drop_ref = false;
586
- spin_lock (& rxnet -> client_conn_cache_lock );
586
+ spin_lock (& local -> client_conn_cache_lock );
587
587
if (!list_empty (& conn -> cache_link )) {
588
588
list_del_init (& conn -> cache_link );
589
589
drop_ref = true;
590
590
}
591
- spin_unlock (& rxnet -> client_conn_cache_lock );
591
+ spin_unlock (& local -> client_conn_cache_lock );
592
592
if (drop_ref )
593
593
rxrpc_put_connection (conn , rxrpc_conn_put_unidle );
594
594
}
@@ -710,14 +710,10 @@ static int rxrpc_wait_for_channel(struct rxrpc_bundle *bundle,
710
710
int rxrpc_connect_call (struct rxrpc_call * call , gfp_t gfp )
711
711
{
712
712
struct rxrpc_bundle * bundle ;
713
- struct rxrpc_local * local = call -> local ;
714
- struct rxrpc_net * rxnet = local -> rxnet ;
715
713
int ret = 0 ;
716
714
717
715
_enter ("{%d,%lx}," , call -> debug_id , call -> user_call_ID );
718
716
719
- rxrpc_discard_expired_client_conns (& rxnet -> client_conn_reaper );
720
-
721
717
rxrpc_get_call (call , rxrpc_call_get_io_thread );
722
718
723
719
bundle = rxrpc_prep_call (call , gfp );
@@ -787,14 +783,14 @@ void rxrpc_expose_client_call(struct rxrpc_call *call)
787
783
/*
788
784
* Set the reap timer.
789
785
*/
790
- static void rxrpc_set_client_reap_timer (struct rxrpc_net * rxnet )
786
+ static void rxrpc_set_client_reap_timer (struct rxrpc_local * local )
791
787
{
792
- if (!rxnet -> kill_all_client_conns ) {
788
+ if (!local -> kill_all_client_conns ) {
793
789
unsigned long now = jiffies ;
794
790
unsigned long reap_at = now + rxrpc_conn_idle_client_expiry ;
795
791
796
- if (rxnet -> live )
797
- timer_reduce (& rxnet -> client_conn_reap_timer , reap_at );
792
+ if (local -> rxnet -> live )
793
+ timer_reduce (& local -> client_conn_reap_timer , reap_at );
798
794
}
799
795
}
800
796
@@ -805,7 +801,7 @@ void rxrpc_disconnect_client_call(struct rxrpc_bundle *bundle, struct rxrpc_call
805
801
{
806
802
struct rxrpc_connection * conn ;
807
803
struct rxrpc_channel * chan = NULL ;
808
- struct rxrpc_net * rxnet = bundle -> local -> rxnet ;
804
+ struct rxrpc_local * local = bundle -> local ;
809
805
unsigned int channel ;
810
806
bool may_reuse ;
811
807
u32 cid ;
@@ -895,11 +891,11 @@ void rxrpc_disconnect_client_call(struct rxrpc_bundle *bundle, struct rxrpc_call
895
891
conn -> idle_timestamp = jiffies ;
896
892
897
893
rxrpc_get_connection (conn , rxrpc_conn_get_idle );
898
- spin_lock (& rxnet -> client_conn_cache_lock );
899
- list_move_tail (& conn -> cache_link , & rxnet -> idle_client_conns );
900
- spin_unlock (& rxnet -> client_conn_cache_lock );
894
+ spin_lock (& local -> client_conn_cache_lock );
895
+ list_move_tail (& conn -> cache_link , & local -> idle_client_conns );
896
+ spin_unlock (& local -> client_conn_cache_lock );
901
897
902
- rxrpc_set_client_reap_timer (rxnet );
898
+ rxrpc_set_client_reap_timer (local );
903
899
}
904
900
905
901
out :
@@ -986,42 +982,34 @@ void rxrpc_kill_client_conn(struct rxrpc_connection *conn)
986
982
* This may be called from conn setup or from a work item so cannot be
987
983
* considered non-reentrant.
988
984
*/
989
- void rxrpc_discard_expired_client_conns (struct work_struct * work )
985
+ void rxrpc_discard_expired_client_conns (struct rxrpc_local * local )
990
986
{
991
987
struct rxrpc_connection * conn ;
992
- struct rxrpc_net * rxnet =
993
- container_of (work , struct rxrpc_net , client_conn_reaper );
994
988
unsigned long expiry , conn_expires_at , now ;
995
989
unsigned int nr_conns ;
996
990
997
991
_enter ("" );
998
992
999
- if (list_empty (& rxnet -> idle_client_conns )) {
993
+ if (list_empty (& local -> idle_client_conns )) {
1000
994
_leave (" [empty]" );
1001
995
return ;
1002
996
}
1003
997
1004
- /* Don't double up on the discarding */
1005
- if (!mutex_trylock (& rxnet -> client_conn_discard_lock )) {
1006
- _leave (" [already]" );
1007
- return ;
1008
- }
1009
-
1010
998
/* We keep an estimate of what the number of conns ought to be after
1011
999
* we've discarded some so that we don't overdo the discarding.
1012
1000
*/
1013
- nr_conns = atomic_read (& rxnet -> nr_client_conns );
1001
+ nr_conns = atomic_read (& local -> rxnet -> nr_client_conns );
1014
1002
1015
1003
next :
1016
- spin_lock (& rxnet -> client_conn_cache_lock );
1004
+ spin_lock (& local -> client_conn_cache_lock );
1017
1005
1018
- if (list_empty (& rxnet -> idle_client_conns ))
1006
+ if (list_empty (& local -> idle_client_conns ))
1019
1007
goto out ;
1020
1008
1021
- conn = list_entry (rxnet -> idle_client_conns .next ,
1009
+ conn = list_entry (local -> idle_client_conns .next ,
1022
1010
struct rxrpc_connection , cache_link );
1023
1011
1024
- if (!rxnet -> kill_all_client_conns ) {
1012
+ if (!local -> kill_all_client_conns ) {
1025
1013
/* If the number of connections is over the reap limit, we
1026
1014
* expedite discard by reducing the expiry timeout. We must,
1027
1015
* however, have at least a short grace period to be able to do
@@ -1044,7 +1032,7 @@ void rxrpc_discard_expired_client_conns(struct work_struct *work)
1044
1032
trace_rxrpc_client (conn , -1 , rxrpc_client_discard );
1045
1033
list_del_init (& conn -> cache_link );
1046
1034
1047
- spin_unlock (& rxnet -> client_conn_cache_lock );
1035
+ spin_unlock (& local -> client_conn_cache_lock );
1048
1036
1049
1037
rxrpc_unbundle_conn (conn );
1050
1038
/* Drop the ->cache_link ref */
@@ -1062,32 +1050,11 @@ void rxrpc_discard_expired_client_conns(struct work_struct *work)
1062
1050
* then things get messier.
1063
1051
*/
1064
1052
_debug ("not yet" );
1065
- if (!rxnet -> kill_all_client_conns )
1066
- timer_reduce (& rxnet -> client_conn_reap_timer , conn_expires_at );
1053
+ if (!local -> kill_all_client_conns )
1054
+ timer_reduce (& local -> client_conn_reap_timer , conn_expires_at );
1067
1055
1068
1056
out :
1069
- spin_unlock (& rxnet -> client_conn_cache_lock );
1070
- mutex_unlock (& rxnet -> client_conn_discard_lock );
1071
- _leave ("" );
1072
- }
1073
-
1074
- /*
1075
- * Preemptively destroy all the client connection records rather than waiting
1076
- * for them to time out
1077
- */
1078
- void rxrpc_destroy_all_client_connections (struct rxrpc_net * rxnet )
1079
- {
1080
- _enter ("" );
1081
-
1082
- spin_lock (& rxnet -> client_conn_cache_lock );
1083
- rxnet -> kill_all_client_conns = true;
1084
- spin_unlock (& rxnet -> client_conn_cache_lock );
1085
-
1086
- del_timer_sync (& rxnet -> client_conn_reap_timer );
1087
-
1088
- if (!rxrpc_queue_work (& rxnet -> client_conn_reaper ))
1089
- _debug ("destroy: queue failed" );
1090
-
1057
+ spin_unlock (& local -> client_conn_cache_lock );
1091
1058
_leave ("" );
1092
1059
}
1093
1060
@@ -1097,14 +1064,19 @@ void rxrpc_destroy_all_client_connections(struct rxrpc_net *rxnet)
1097
1064
void rxrpc_clean_up_local_conns (struct rxrpc_local * local )
1098
1065
{
1099
1066
struct rxrpc_connection * conn , * tmp ;
1100
- struct rxrpc_net * rxnet = local -> rxnet ;
1101
1067
LIST_HEAD (graveyard );
1102
1068
1103
1069
_enter ("" );
1104
1070
1105
- spin_lock (& rxnet -> client_conn_cache_lock );
1071
+ spin_lock (& local -> client_conn_cache_lock );
1072
+ local -> kill_all_client_conns = true;
1073
+ spin_unlock (& local -> client_conn_cache_lock );
1074
+
1075
+ del_timer_sync (& local -> client_conn_reap_timer );
1076
+
1077
+ spin_lock (& local -> client_conn_cache_lock );
1106
1078
1107
- list_for_each_entry_safe (conn , tmp , & rxnet -> idle_client_conns ,
1079
+ list_for_each_entry_safe (conn , tmp , & local -> idle_client_conns ,
1108
1080
cache_link ) {
1109
1081
if (conn -> local == local ) {
1110
1082
atomic_dec (& conn -> active );
@@ -1113,7 +1085,7 @@ void rxrpc_clean_up_local_conns(struct rxrpc_local *local)
1113
1085
}
1114
1086
}
1115
1087
1116
- spin_unlock (& rxnet -> client_conn_cache_lock );
1088
+ spin_unlock (& local -> client_conn_cache_lock );
1117
1089
1118
1090
while (!list_empty (& graveyard )) {
1119
1091
conn = list_entry (graveyard .next ,
0 commit comments