Commit df46a0b8 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Changpeng Liu
Browse files

lib/iscsi: Move Logout check from iscsi_conn_handle_incoming_pdus() to spdk_iscsi_read_pdu()



Move logout check from iscsi_conn_handle_incoming_pdus() to
spdk_iscsi_read_pdu() to introduce state machine into receive
incoming PDUs processing.

Besides, remove a debug log because similar debug log is already
collected in spdk_iscsi_conn_read_data().

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I11ee800eb1fd60796669d5390bd3cd1031066ca7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470285


Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 83a48901
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -1405,14 +1405,7 @@ iscsi_conn_handle_incoming_pdus(struct spdk_iscsi_conn *conn)
		if (rc == 0) {
			break;
		} else if (rc < 0) {
			SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "Failed to read pdu, error=%d\n", rc);
			return SPDK_ISCSI_CONNECTION_FATAL;
		}

		if (conn->is_logged_out) {
			SPDK_ERRLOG("pdu received after logout\n");
			spdk_put_pdu(pdu);
			return SPDK_ISCSI_CONNECTION_FATAL;
			return rc;
		}

		rc = spdk_iscsi_execute(conn, pdu);
+7 −4
Original line number Diff line number Diff line
@@ -4683,7 +4683,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
		} else {
			SPDK_ERRLOG("Data(%d) > MaxSegment(%d)\n",
				    data_len, SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH);
			rc = SPDK_ISCSI_CONNECTION_FATAL;
			goto error;
		}
		pdu->mobj = spdk_mempool_get(pool);
@@ -4741,7 +4740,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
		rc = MATCH_DIGEST_WORD(pdu->header_digest, crc32c);
		if (rc == 0) {
			SPDK_ERRLOG("header digest error (%s)\n", conn->initiator_name);
			rc = SPDK_ISCSI_CONNECTION_FATAL;
			goto error;
		}
	}
@@ -4749,19 +4747,24 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
		crc32c = spdk_iscsi_pdu_calc_data_digest(pdu);
		rc = MATCH_DIGEST_WORD(pdu->data_digest, crc32c);
		if (rc == 0) {
			rc = SPDK_ISCSI_CONNECTION_FATAL;
			SPDK_ERRLOG("data digest error (%s)\n", conn->initiator_name);
			goto error;
		}
	}

	if (conn->is_logged_out) {
		SPDK_ERRLOG("pdu received after logout\n");
		spdk_put_pdu(pdu);
		return SPDK_ISCSI_CONNECTION_FATAL;
	}

	*_pdu = pdu;
	return 1;

error:
	spdk_put_pdu(pdu);
	conn->pdu_in_progress = NULL;
	return rc;
	return SPDK_ISCSI_CONNECTION_FATAL;
}

bool