iscsi: Fix the issue caused by cleanup LUNs when exiting connection

When exiting connection, all active tasks are aborted by
spdk_iscsi_tgt_node_cleanup() in lib/iscsi/tgt_node.c.

In spdk_iscsi_tgt_node_cleanup(), spdk_iscsi_op_abort_task_set()
is called by using a temporary task without associating PDU.

This call of spdk_iscsi_op_abort_task_set() have resulted in
assertion in spdk_iscsi_conn_abort_queued_datain_tasks() because
task->pdu is NULL.

The fix is to remove the assertion in
spdk_iscsi_conn_abort_queued_datain_tasks() and add check if
pdu == NULL as true condition.

This issue was detected by ip_migration test. ip_migration test
runs only in nightly tests now but it consumes only 26 seconds,
and the next patch moves ip_migration test to per-patch tests.

Fixes #544

Change-Id: I7719ad57d22c4354530adabfcdc5a818c804b841
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/438223
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Shuhei Matsumoto 2018-12-26 10:07:07 +09:00 committed by Darek Stojaczyk
parent 0bf22fb8d9
commit eb6bac0aa9

View File

@ -3228,12 +3228,10 @@ spdk_iscsi_conn_abort_queued_datain_tasks(struct spdk_iscsi_conn *conn,
struct spdk_iscsi_pdu *pdu_tmp;
int rc;
assert(pdu != NULL);
TAILQ_FOREACH_SAFE(task, &conn->queued_datain_tasks, link, task_tmp) {
pdu_tmp = spdk_iscsi_task_get_pdu(task);
if ((lun == NULL || lun == task->scsi.lun) &&
(SN32_LT(pdu_tmp->cmd_sn, pdu->cmd_sn))) {
(pdu == NULL || (SN32_LT(pdu_tmp->cmd_sn, pdu->cmd_sn)))) {
rc = _spdk_iscsi_conn_abort_queued_datain_task(conn, task);
if (rc != 0) {
return rc;