nvme/tcp: fix the user iov length caculation in nvme_tcp_build_sgl_request

The length should be no larger than the remaining_size.
For example, The remaining_size(firstly, assigned by payload_size) is 128KB,
and user's sgl length is 1MB. Since we already split the I/O, so we should
not use the original length(1MB), but use the remaining_size.

Fix issue reported by: https://github.com/spdk/spdk/issues/808

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I0a7d0f2282c8ad0e253d8de7091b6c5b87018e9a
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456760
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ziye Yang 2019-06-04 22:27:36 +08:00 committed by Changpeng Liu
parent 5391b29c79
commit 31607f3f9e

View File

@ -528,6 +528,7 @@ nvme_tcp_build_sgl_request(struct nvme_tcp_qpair *tqpair, struct nvme_tcp_req *t
return -1;
}
length = spdk_min(length, remaining_size);
tcp_req->iov[iovcnt].iov_len = length;
remaining_size -= length;
iovcnt++;