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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Ife5900b3075c35dfe3890fa1d9f99a6935d40a9f Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458540 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
3ff1ff004e
commit
5cfc19af37
@ -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);
|
_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 */
|
/* check the plen for the first time constructing iov */
|
||||||
if (!pdu->writev_offset) {
|
if (!pdu->writev_offset) {
|
||||||
assert(plen == pdu->hdr.common.plen);
|
assert(plen == pdu->hdr.common.plen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
if (_mapped_length != NULL) {
|
||||||
|
*_mapped_length = sgl->total_size;
|
||||||
|
}
|
||||||
|
|
||||||
return iovcnt - sgl->iovcnt;
|
return iovcnt - sgl->iovcnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user