|
@@ -82,6 +82,7 @@ static struct iscsi_login *iscsi_login_init_conn(struct iscsi_conn *conn)
|
|
|
init_completion(&conn->conn_logout_comp);
|
|
|
init_completion(&conn->rx_half_close_comp);
|
|
|
init_completion(&conn->tx_half_close_comp);
|
|
|
+ init_completion(&conn->rx_login_comp);
|
|
|
spin_lock_init(&conn->cmd_lock);
|
|
|
spin_lock_init(&conn->conn_usage_lock);
|
|
|
spin_lock_init(&conn->immed_queue_lock);
|
|
@@ -644,7 +645,7 @@ static void iscsi_post_login_start_timers(struct iscsi_conn *conn)
|
|
|
iscsit_start_nopin_timer(conn);
|
|
|
}
|
|
|
|
|
|
-static int iscsit_start_kthreads(struct iscsi_conn *conn)
|
|
|
+int iscsit_start_kthreads(struct iscsi_conn *conn)
|
|
|
{
|
|
|
int ret = 0;
|
|
|
|
|
@@ -679,6 +680,7 @@ static int iscsit_start_kthreads(struct iscsi_conn *conn)
|
|
|
|
|
|
return 0;
|
|
|
out_tx:
|
|
|
+ send_sig(SIGINT, conn->tx_thread, 1);
|
|
|
kthread_stop(conn->tx_thread);
|
|
|
conn->tx_thread_active = false;
|
|
|
out_bitmap:
|
|
@@ -689,7 +691,7 @@ out_bitmap:
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-int iscsi_post_login_handler(
|
|
|
+void iscsi_post_login_handler(
|
|
|
struct iscsi_np *np,
|
|
|
struct iscsi_conn *conn,
|
|
|
u8 zero_tsih)
|
|
@@ -699,7 +701,6 @@ int iscsi_post_login_handler(
|
|
|
struct se_session *se_sess = sess->se_sess;
|
|
|
struct iscsi_portal_group *tpg = sess->tpg;
|
|
|
struct se_portal_group *se_tpg = &tpg->tpg_se_tpg;
|
|
|
- int rc;
|
|
|
|
|
|
iscsit_inc_conn_usage_count(conn);
|
|
|
|
|
@@ -739,10 +740,6 @@ int iscsi_post_login_handler(
|
|
|
sess->sess_ops->InitiatorName);
|
|
|
spin_unlock_bh(&sess->conn_lock);
|
|
|
|
|
|
- rc = iscsit_start_kthreads(conn);
|
|
|
- if (rc)
|
|
|
- return rc;
|
|
|
-
|
|
|
iscsi_post_login_start_timers(conn);
|
|
|
/*
|
|
|
* Determine CPU mask to ensure connection's RX and TX kthreads
|
|
@@ -751,15 +748,20 @@ int iscsi_post_login_handler(
|
|
|
iscsit_thread_get_cpumask(conn);
|
|
|
conn->conn_rx_reset_cpumask = 1;
|
|
|
conn->conn_tx_reset_cpumask = 1;
|
|
|
-
|
|
|
+ /*
|
|
|
+ * Wakeup the sleeping iscsi_target_rx_thread() now that
|
|
|
+ * iscsi_conn is in TARG_CONN_STATE_LOGGED_IN state.
|
|
|
+ */
|
|
|
+ complete(&conn->rx_login_comp);
|
|
|
iscsit_dec_conn_usage_count(conn);
|
|
|
+
|
|
|
if (stop_timer) {
|
|
|
spin_lock_bh(&se_tpg->session_lock);
|
|
|
iscsit_stop_time2retain_timer(sess);
|
|
|
spin_unlock_bh(&se_tpg->session_lock);
|
|
|
}
|
|
|
iscsit_dec_session_usage_count(sess);
|
|
|
- return 0;
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
iscsi_set_session_parameters(sess->sess_ops, conn->param_list, 1);
|
|
@@ -800,10 +802,6 @@ int iscsi_post_login_handler(
|
|
|
" iSCSI Target Portal Group: %hu\n", tpg->nsessions, tpg->tpgt);
|
|
|
spin_unlock_bh(&se_tpg->session_lock);
|
|
|
|
|
|
- rc = iscsit_start_kthreads(conn);
|
|
|
- if (rc)
|
|
|
- return rc;
|
|
|
-
|
|
|
iscsi_post_login_start_timers(conn);
|
|
|
/*
|
|
|
* Determine CPU mask to ensure connection's RX and TX kthreads
|
|
@@ -812,10 +810,12 @@ int iscsi_post_login_handler(
|
|
|
iscsit_thread_get_cpumask(conn);
|
|
|
conn->conn_rx_reset_cpumask = 1;
|
|
|
conn->conn_tx_reset_cpumask = 1;
|
|
|
-
|
|
|
+ /*
|
|
|
+ * Wakeup the sleeping iscsi_target_rx_thread() now that
|
|
|
+ * iscsi_conn is in TARG_CONN_STATE_LOGGED_IN state.
|
|
|
+ */
|
|
|
+ complete(&conn->rx_login_comp);
|
|
|
iscsit_dec_conn_usage_count(conn);
|
|
|
-
|
|
|
- return 0;
|
|
|
}
|
|
|
|
|
|
static void iscsi_handle_login_thread_timeout(unsigned long data)
|
|
@@ -1380,23 +1380,12 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
|
|
|
if (ret < 0)
|
|
|
goto new_sess_out;
|
|
|
|
|
|
- if (!conn->sess) {
|
|
|
- pr_err("struct iscsi_conn session pointer is NULL!\n");
|
|
|
- goto new_sess_out;
|
|
|
- }
|
|
|
-
|
|
|
iscsi_stop_login_thread_timer(np);
|
|
|
|
|
|
- if (signal_pending(current))
|
|
|
- goto new_sess_out;
|
|
|
-
|
|
|
if (ret == 1) {
|
|
|
tpg_np = conn->tpg_np;
|
|
|
|
|
|
- ret = iscsi_post_login_handler(np, conn, zero_tsih);
|
|
|
- if (ret < 0)
|
|
|
- goto new_sess_out;
|
|
|
-
|
|
|
+ iscsi_post_login_handler(np, conn, zero_tsih);
|
|
|
iscsit_deaccess_np(np, tpg, tpg_np);
|
|
|
}
|
|
|
|