2424#include "iscsi_target_tq.h"
2525#include "iscsi_target.h"
2626
27- static LIST_HEAD (active_ts_list );
2827static LIST_HEAD (inactive_ts_list );
29- static DEFINE_SPINLOCK (active_ts_lock );
3028static DEFINE_SPINLOCK (inactive_ts_lock );
3129static DEFINE_SPINLOCK (ts_bitmap_lock );
3230
33- static void iscsi_add_ts_to_active_list (struct iscsi_thread_set * ts )
34- {
35- spin_lock (& active_ts_lock );
36- list_add_tail (& ts -> ts_list , & active_ts_list );
37- iscsit_global -> active_ts ++ ;
38- spin_unlock (& active_ts_lock );
39- }
40-
4131static void iscsi_add_ts_to_inactive_list (struct iscsi_thread_set * ts )
4232{
33+ if (!list_empty (& ts -> ts_list )) {
34+ WARN_ON (1 );
35+ return ;
36+ }
4337 spin_lock (& inactive_ts_lock );
4438 list_add_tail (& ts -> ts_list , & inactive_ts_list );
4539 iscsit_global -> inactive_ts ++ ;
4640 spin_unlock (& inactive_ts_lock );
4741}
4842
49- static void iscsi_del_ts_from_active_list (struct iscsi_thread_set * ts )
50- {
51- spin_lock (& active_ts_lock );
52- list_del (& ts -> ts_list );
53- iscsit_global -> active_ts -- ;
54- spin_unlock (& active_ts_lock );
55- }
56-
5743static struct iscsi_thread_set * iscsi_get_ts_from_inactive_list (void )
5844{
5945 struct iscsi_thread_set * ts ;
@@ -66,7 +52,7 @@ static struct iscsi_thread_set *iscsi_get_ts_from_inactive_list(void)
6652
6753 ts = list_first_entry (& inactive_ts_list , struct iscsi_thread_set , ts_list );
6854
69- list_del (& ts -> ts_list );
55+ list_del_init (& ts -> ts_list );
7056 iscsit_global -> inactive_ts -- ;
7157 spin_unlock (& inactive_ts_lock );
7258
@@ -204,8 +190,6 @@ static void iscsi_deallocate_extra_thread_sets(void)
204190
205191void iscsi_activate_thread_set (struct iscsi_conn * conn , struct iscsi_thread_set * ts )
206192{
207- iscsi_add_ts_to_active_list (ts );
208-
209193 spin_lock_bh (& ts -> ts_state_lock );
210194 conn -> thread_set = ts ;
211195 ts -> conn = conn ;
@@ -397,7 +381,6 @@ struct iscsi_conn *iscsi_rx_thread_pre_handler(struct iscsi_thread_set *ts)
397381
398382 if (ts -> delay_inactive && (-- ts -> thread_count == 0 )) {
399383 spin_unlock_bh (& ts -> ts_state_lock );
400- iscsi_del_ts_from_active_list (ts );
401384
402385 if (!iscsit_global -> in_shutdown )
403386 iscsi_deallocate_extra_thread_sets ();
@@ -452,7 +435,6 @@ struct iscsi_conn *iscsi_tx_thread_pre_handler(struct iscsi_thread_set *ts)
452435
453436 if (ts -> delay_inactive && (-- ts -> thread_count == 0 )) {
454437 spin_unlock_bh (& ts -> ts_state_lock );
455- iscsi_del_ts_from_active_list (ts );
456438
457439 if (!iscsit_global -> in_shutdown )
458440 iscsi_deallocate_extra_thread_sets ();
0 commit comments