@@ -479,12 +479,18 @@ static int iscsi_target_do_login(struct iscsi_conn *, struct iscsi_login *);
479
479
480
480
static bool __iscsi_target_sk_check_close (struct sock * sk )
481
481
{
482
- if (sk -> sk_state == TCP_CLOSE_WAIT || sk -> sk_state == TCP_CLOSE ) {
483
- pr_debug ("__iscsi_target_sk_check_close: TCP_CLOSE_WAIT|TCP_CLOSE,"
484
- "returning FALSE\n" );
482
+ switch (sk -> sk_state ) {
483
+ case TCP_FIN_WAIT1 :
484
+ case TCP_FIN_WAIT2 :
485
+ case TCP_CLOSE_WAIT :
486
+ case TCP_LAST_ACK :
487
+ case TCP_CLOSE :
488
+ pr_debug ("__iscsi_target_sk_check_close: socket closing,"
489
+ "returning TRUE\n" );
485
490
return true;
491
+ default :
492
+ return false;
486
493
}
487
- return false;
488
494
}
489
495
490
496
static bool iscsi_target_sk_check_close (struct iscsi_conn * conn )
@@ -542,25 +548,6 @@ static void iscsi_target_login_drop(struct iscsi_conn *conn, struct iscsi_login
542
548
iscsi_target_login_sess_out (conn , zero_tsih , true);
543
549
}
544
550
545
- struct conn_timeout {
546
- struct timer_list timer ;
547
- struct iscsi_conn * conn ;
548
- };
549
-
550
- static void iscsi_target_login_timeout (struct timer_list * t )
551
- {
552
- struct conn_timeout * timeout = from_timer (timeout , t , timer );
553
- struct iscsi_conn * conn = timeout -> conn ;
554
-
555
- pr_debug ("Entering iscsi_target_login_timeout >>>>>>>>>>>>>>>>>>>\n" );
556
-
557
- if (conn -> login_kworker ) {
558
- pr_debug ("Sending SIGINT to conn->login_kworker %s/%d\n" ,
559
- conn -> login_kworker -> comm , conn -> login_kworker -> pid );
560
- send_sig (SIGINT , conn -> login_kworker , 1 );
561
- }
562
- }
563
-
564
551
static void iscsi_target_do_login_rx (struct work_struct * work )
565
552
{
566
553
struct iscsi_conn * conn = container_of (work ,
@@ -569,7 +556,6 @@ static void iscsi_target_do_login_rx(struct work_struct *work)
569
556
struct iscsi_np * np = login -> np ;
570
557
struct iscsi_portal_group * tpg = conn -> tpg ;
571
558
struct iscsi_tpg_np * tpg_np = conn -> tpg_np ;
572
- struct conn_timeout timeout ;
573
559
int rc , zero_tsih = login -> zero_tsih ;
574
560
bool state ;
575
561
@@ -607,14 +593,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work)
607
593
conn -> login_kworker = current ;
608
594
allow_signal (SIGINT );
609
595
610
- timeout .conn = conn ;
611
- timer_setup_on_stack (& timeout .timer , iscsi_target_login_timeout , 0 );
612
- mod_timer (& timeout .timer , jiffies + TA_LOGIN_TIMEOUT * HZ );
613
- pr_debug ("Starting login timer for %s/%d\n" , current -> comm , current -> pid );
614
-
615
596
rc = conn -> conn_transport -> iscsit_get_login_rx (conn , login );
616
- del_timer_sync (& timeout .timer );
617
- destroy_timer_on_stack (& timeout .timer );
618
597
flush_signals (current );
619
598
conn -> login_kworker = NULL ;
620
599
@@ -631,6 +610,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work)
631
610
if (iscsi_target_sk_check_and_clear (conn , LOGIN_FLAGS_READ_ACTIVE ))
632
611
goto err ;
633
612
} else if (rc == 1 ) {
613
+ iscsit_stop_login_timer (conn );
634
614
iscsi_target_nego_release (conn );
635
615
iscsi_post_login_handler (np , conn , zero_tsih );
636
616
iscsit_deaccess_np (np , tpg , tpg_np );
@@ -639,6 +619,7 @@ static void iscsi_target_do_login_rx(struct work_struct *work)
639
619
640
620
err :
641
621
iscsi_target_restore_sock_callbacks (conn );
622
+ iscsit_stop_login_timer (conn );
642
623
iscsi_target_login_drop (conn , login );
643
624
iscsit_deaccess_np (np , tpg , tpg_np );
644
625
}
@@ -1283,6 +1264,9 @@ int iscsi_target_start_negotiation(
1283
1264
set_bit (LOGIN_FLAGS_INITIAL_PDU , & conn -> login_flags );
1284
1265
write_unlock_bh (& sk -> sk_callback_lock );
1285
1266
}
1267
+
1268
+ iscsit_start_login_timer (conn );
1269
+
1286
1270
/*
1287
1271
* If iscsi_target_do_login returns zero to signal more PDU
1288
1272
* exchanges are required to complete the login, go ahead and
@@ -1301,8 +1285,10 @@ int iscsi_target_start_negotiation(
1301
1285
iscsi_target_restore_sock_callbacks (conn );
1302
1286
iscsi_remove_failed_auth_entry (conn );
1303
1287
}
1304
- if (ret != 0 )
1288
+ if (ret != 0 ) {
1289
+ iscsit_stop_login_timer (conn );
1305
1290
iscsi_target_nego_release (conn );
1291
+ }
1306
1292
1307
1293
return ret ;
1308
1294
}
0 commit comments