Commit 5cfc19af authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Darek Stojaczyk
Browse files

nvme/tcp: Move assert to the correct location in nvme_tcp_build_iovs



When the iovec array becomes full in the middle of the data segment,
plen may not be equal to pdu->hdr.common.plen because data digest
is not included.

This doesn't cause any error in release mode but fix this for debug
mode.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 3ff1ff00
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -307,16 +307,16 @@ nvme_tcp_build_iovs(struct iovec *iov, int iovcnt, struct nvme_tcp_pdu *pdu,
		_nvme_tcp_sgl_append(sgl, pdu->data_digest, SPDK_NVME_TCP_DIGEST_LEN);
	}

end:
	if (_mapped_length != NULL) {
		*_mapped_length = sgl->total_size;
	}

	/* check the plen for the first time constructing iov */
	if (!pdu->writev_offset) {
		assert(plen == pdu->hdr.common.plen);
	}

end:
	if (_mapped_length != NULL) {
		*_mapped_length = sgl->total_size;
	}

	return iovcnt - sgl->iovcnt;
}