iscsi: Solve the potential no io channel issue.

Reason: If we trigger the spdk_iscsi_conn_migration,
we may face the issue that the io channel of lun
is NULL(which means not allocated). So I think
that if we trigger the migration, we need to
stop the executing the further pdu of this conn
by the current polling group.

Also since the connection is triggered migration,
we should stop execution on the current core, and
let this connection be handled by next round.

Change-Id: I0ab89d79c976f3233890ae25cb7eac98de5e30ac
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/409984
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Ziye Yang 2018-05-04 14:43:59 +08:00 committed by Changpeng Liu
parent 3dab6c9570
commit d10401cc07
2 changed files with 7 additions and 0 deletions

View File

@ -200,6 +200,7 @@ spdk_iscsi_poll_group_add_conn(struct spdk_iscsi_conn *conn)
{
struct spdk_iscsi_poll_group *poll_group = &g_spdk_iscsi.poll_group[spdk_env_get_current_core()];
conn->is_stopped = false;
STAILQ_INSERT_TAIL(&poll_group->connections, conn, link);
spdk_iscsi_poll_group_add_conn_sock(conn);
}
@ -209,6 +210,7 @@ spdk_iscsi_poll_group_remove_conn(struct spdk_iscsi_conn *conn)
{
struct spdk_iscsi_poll_group *poll_group = &g_spdk_iscsi.poll_group[spdk_env_get_current_core()];
conn->is_stopped = true;
STAILQ_REMOVE(&poll_group->connections, conn, spdk_iscsi_conn, link);
}
@ -1154,6 +1156,10 @@ spdk_iscsi_conn_handle_incoming_pdus(struct spdk_iscsi_conn *conn)
conn->initiator_port != NULL ? spdk_scsi_port_get_name(conn->initiator_port) : "NULL");
return rc;
}
if (conn->is_stopped) {
break;
}
}
return i;

View File

@ -160,6 +160,7 @@ struct spdk_iscsi_conn {
STAILQ_ENTRY(spdk_iscsi_conn) link;
struct spdk_poller *flush_poller;
bool is_stopped; /* Set true when connection is stopped for migration */
TAILQ_HEAD(queued_r2t_tasks, spdk_iscsi_task) queued_r2t_tasks;
TAILQ_HEAD(active_r2t_tasks, spdk_iscsi_task) active_r2t_tasks;
TAILQ_HEAD(queued_datain_tasks, spdk_iscsi_task) queued_datain_tasks;