Skip to content

Commit a093f45

Browse files
pcd1193182Delphix Engineering
authored andcommitted
DLPX-83697 iscsi target login should wait until tx/rx threads have properly started (#14)
1 parent a2e538b commit a093f45

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

drivers/target/iscsi/iscsi_target.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3870,6 +3870,7 @@ int iscsi_target_tx_thread(void *arg)
38703870
* connection recovery / failure event can be triggered externally.
38713871
*/
38723872
allow_signal(SIGINT);
3873+
complete(&conn->kthr_start_comp);
38733874

38743875
while (!kthread_should_stop()) {
38753876
/*
@@ -4116,6 +4117,7 @@ int iscsi_target_rx_thread(void *arg)
41164117
* connection recovery / failure event can be triggered externally.
41174118
*/
41184119
allow_signal(SIGINT);
4120+
complete(&conn->kthr_start_comp);
41194121
/*
41204122
* Wait for iscsi_post_login_handler() to complete before allowing
41214123
* incoming iscsi/tcp socket I/O, and/or failing the connection.

drivers/target/iscsi/iscsi_target_login.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ int iscsit_start_kthreads(struct iscsit_conn *conn)
619619
ret = PTR_ERR(conn->tx_thread);
620620
goto out_bitmap;
621621
}
622+
wait_for_completion(&conn->kthr_start_comp);
622623
conn->tx_thread_active = true;
623624

624625
conn->rx_thread = kthread_run(iscsi_target_rx_thread, conn,
@@ -628,6 +629,7 @@ int iscsit_start_kthreads(struct iscsit_conn *conn)
628629
ret = PTR_ERR(conn->rx_thread);
629630
goto out_tx;
630631
}
632+
wait_for_completion(&conn->kthr_start_comp);
631633
conn->rx_thread_active = true;
632634

633635
return 0;
@@ -1023,6 +1025,7 @@ static struct iscsit_conn *iscsit_alloc_conn(struct iscsi_np *np)
10231025
init_completion(&conn->rx_half_close_comp);
10241026
init_completion(&conn->tx_half_close_comp);
10251027
init_completion(&conn->rx_login_comp);
1028+
init_completion(&conn->kthr_start_comp);
10261029
spin_lock_init(&conn->cmd_lock);
10271030
spin_lock_init(&conn->conn_usage_lock);
10281031
spin_lock_init(&conn->immed_queue_lock);

include/target/iscsi/iscsi_target_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ struct iscsit_conn {
550550
struct completion conn_logout_comp;
551551
struct completion tx_half_close_comp;
552552
struct completion rx_half_close_comp;
553+
struct completion kthr_start_comp;
553554
/* socket used by this connection */
554555
struct socket *sock;
555556
void (*orig_data_ready)(struct sock *);

0 commit comments

Comments
 (0)