From 06481fc2235335aaf7eee53a3a2ecf044a4f2ec3 Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Wed, 2 Oct 2019 10:40:40 +0000 Subject: [PATCH] rdma: Check -EINVAL return value of spdk_nvmf_rdma_request_fill_iovs Return -1 from spdk_nvmf_rdma_request_parse_sgl in the case of -EINVAL since 0 value returned by spdk_nvmf_rdma_request_parse_sgl is treated as no memory case Change-Id: I536592260a3bb658a1a4bc3a79c5b37fbacd3edc Signed-off-by: Alexey Marchuk Signed-off-by: Sasha Kotchubievsky Signed-off-by: Evgenii Kochetov Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/470471 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- lib/nvmf/rdma.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index 79fff7c4f..225aba967 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -1837,7 +1837,12 @@ spdk_nvmf_rdma_request_parse_sgl(struct spdk_nvmf_rdma_transport *rtransport, req->dif.elba_length = length; } - if (spdk_nvmf_rdma_request_fill_iovs(rtransport, device, rdma_req, length) < 0) { + rc = spdk_nvmf_rdma_request_fill_iovs(rtransport, device, rdma_req, length); + if (spdk_unlikely(rc < 0)) { + if (rc == -EINVAL) { + SPDK_ERRLOG("SGL length exceeds the max I/O size\n"); + return -1; + } /* No available buffers. Queue this request up. */ SPDK_DEBUGLOG(SPDK_LOG_RDMA, "No available large data buffers. Queueing request %p\n", rdma_req); return 0;