lib/iscsi: Send message to request logout to active connection
The next patch will create a SPDK thread for each poll group at startup. Hence iSCSI connection will be created or destroyed on these threads. On the other hand, logout request to the active connection will be still invoked by the default thread. This unmatch will hit assertion such that poller is unregistered different thread that registered it. Fix this unmatch by sending message to the thread explicitly to request logout and wait for the logout process to start. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Iff361e78b9ba077230e38d9586f7187968e33314 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/490 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
5adeda4807
commit
239a407897
@ -828,22 +828,37 @@ logout_request_timeout(void *arg)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If the connection is running and logout is not requested yet, request logout
|
||||
* to initiator and wait for the logout process to start.
|
||||
*/
|
||||
static void
|
||||
_iscsi_conn_request_logout(void *ctx)
|
||||
{
|
||||
struct spdk_iscsi_conn *conn = ctx;
|
||||
|
||||
if (conn->state > ISCSI_CONN_STATE_RUNNING ||
|
||||
conn->logout_request_timer != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
iscsi_send_logout_request(conn);
|
||||
|
||||
conn->logout_request_timer = spdk_poller_register(logout_request_timeout,
|
||||
conn, ISCSI_LOGOUT_REQUEST_TIMEOUT * 1000000);
|
||||
}
|
||||
|
||||
static void
|
||||
iscsi_conn_request_logout(struct spdk_iscsi_conn *conn)
|
||||
{
|
||||
struct spdk_thread *thread;
|
||||
|
||||
if (conn->state == ISCSI_CONN_STATE_INVALID) {
|
||||
/* Move it to EXITING state if the connection is in login. */
|
||||
conn->state = ISCSI_CONN_STATE_EXITING;
|
||||
} else if (conn->state == ISCSI_CONN_STATE_RUNNING &&
|
||||
conn->logout_request_timer == NULL) {
|
||||
/* If the connection is running and logout is not requested yet,
|
||||
* request logout to initiator and wait for the logout process
|
||||
* to start.
|
||||
*/
|
||||
iscsi_send_logout_request(conn);
|
||||
|
||||
conn->logout_request_timer = spdk_poller_register(logout_request_timeout,
|
||||
conn, ISCSI_LOGOUT_REQUEST_TIMEOUT * 1000000);
|
||||
thread = spdk_io_channel_get_thread(spdk_io_channel_from_ctx(conn->pg));
|
||||
spdk_thread_send_msg(thread, _iscsi_conn_request_logout, conn);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user