From eb6bac0aa93ad839c7f3fb43772722782b6dd143 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 26 Dec 2018 10:07:07 +0900 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/438223 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Darek Stojaczyk Reviewed-by: Ziye Yang Reviewed-by: Changpeng Liu --- lib/iscsi/iscsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 4e6d014c5..36ba5f123 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -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;