nvme_ns_cmd: fix bug in split_request_sgl

The while loop in this function was structured such that if the final
child request did not contain a full number of SGE elements, it would be
truncated. We need to not only check whether we have a full number of
SGEs, but also if the current child has consumed the end of the parent
request.

Change-Id: I7df6c224e9ab66033c92d2cf1af10452f5cdfd9b
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450684
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2019-04-09 11:19:31 -07:00 committed by Jim Harris
parent c459cb6e70
commit b2e778b271

View File

@ -382,7 +382,7 @@ _nvme_ns_cmd_split_request_sgl(struct spdk_nvme_ns *ns,
req_current_length += sge_length;
num_sges++;
if (num_sges < max_sges) {
if (num_sges < max_sges && req_current_length < req->payload_size) {
continue;
}