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

iscsi: Update _pdu only when completing read in spdk_iscsi_read_pdu



The only caller iscsi_conn_handle_incoming_pdus accesses the returned
pdu only when the return code is 1. So we can remove update of
_pdu for other cases in spdk_iscsi_read_pdu.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 2882b989
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -426,7 +426,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
		}
		pdu->bhs_valid_bytes += rc;
		if (pdu->bhs_valid_bytes < ISCSI_BHS_LEN) {
			*_pdu = NULL;
			return 0;
		}
	}
@@ -446,7 +445,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)

		pdu->ahs_valid_bytes += rc;
		if (pdu->ahs_valid_bytes < ahs_len) {
			*_pdu = NULL;
			return 0;
		}
	}
@@ -463,7 +461,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)

		pdu->hdigest_valid_bytes += rc;
		if (pdu->hdigest_valid_bytes < ISCSI_DIGEST_LEN) {
			*_pdu = NULL;
			return 0;
		}
	}
@@ -484,7 +481,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
			}
			pdu->mobj = spdk_mempool_get(pool);
			if (pdu->mobj == NULL) {
				*_pdu = NULL;
				return 0;
			}
			pdu->data_buf = pdu->mobj->buf;
@@ -497,7 +493,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)

		pdu->data_valid_bytes += rc;
		if (pdu->data_valid_bytes < data_len) {
			*_pdu = NULL;
			return 0;
		}
	}
@@ -514,7 +509,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)

		pdu->ddigest_valid_bytes += rc;
		if (pdu->ddigest_valid_bytes < ISCSI_DIGEST_LEN) {
			*_pdu = NULL;
			return 0;
		}
	}
@@ -570,7 +564,6 @@ spdk_iscsi_read_pdu(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu **_pdu)
	return 1;

error:
	*_pdu = NULL;
	spdk_put_pdu(pdu);
	conn->pdu_in_progress = NULL;
	return SPDK_ISCSI_CONNECTION_FATAL;