Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLPX-83697 iscsi target login should wait until tx/rx threads have properly started #21

Merged
merged 2 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions drivers/target/iscsi/iscsi_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -3813,6 +3813,7 @@ int iscsi_target_tx_thread(void *arg)
* connection recovery / failure event can be triggered externally.
*/
allow_signal(SIGINT);
complete(&conn->kthr_start_comp);

while (!kthread_should_stop()) {
/*
Expand Down Expand Up @@ -4041,6 +4042,7 @@ int iscsi_target_rx_thread(void *arg)
* connection recovery / failure event can be triggered externally.
*/
allow_signal(SIGINT);
complete(&conn->kthr_start_comp);
/*
* Wait for iscsi_post_login_handler() to complete before allowing
* incoming iscsi/tcp socket I/O, and/or failing the connection.
Expand Down
3 changes: 3 additions & 0 deletions drivers/target/iscsi/iscsi_target_login.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ int iscsit_start_kthreads(struct iscsi_conn *conn)
ret = PTR_ERR(conn->tx_thread);
goto out_bitmap;
}
wait_for_completion(&conn->kthr_start_comp);
conn->tx_thread_active = true;

conn->rx_thread = kthread_run(iscsi_target_rx_thread, conn,
Expand All @@ -655,6 +656,7 @@ int iscsit_start_kthreads(struct iscsi_conn *conn)
ret = PTR_ERR(conn->rx_thread);
goto out_tx;
}
wait_for_completion(&conn->kthr_start_comp);
conn->rx_thread_active = true;

return 0;
Expand Down Expand Up @@ -1127,6 +1129,7 @@ static struct iscsi_conn *iscsit_alloc_conn(struct iscsi_np *np)
init_completion(&conn->rx_half_close_comp);
init_completion(&conn->tx_half_close_comp);
init_completion(&conn->rx_login_comp);
init_completion(&conn->kthr_start_comp);
spin_lock_init(&conn->cmd_lock);
spin_lock_init(&conn->conn_usage_lock);
spin_lock_init(&conn->immed_queue_lock);
Expand Down
1 change: 1 addition & 0 deletions include/target/iscsi/iscsi_target_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ struct iscsi_conn {
struct completion conn_logout_comp;
struct completion tx_half_close_comp;
struct completion rx_half_close_comp;
struct completion kthr_start_comp;
/* socket used by this connection */
struct socket *sock;
void (*orig_data_ready)(struct sock *);
Expand Down