From 5391b29c797abbb48432a29656ec2db436580680 Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Tue, 28 May 2019 18:00:48 +0800 Subject: [PATCH] nvme/tcp: Fix the issue of handling send pdu failure Previously, if the return value of nvme_tcp_qpair_process_send_queue is not zero, we directly return but not continue receiving the pdu. But this is wrong, we should only handle the case when the return value is negative. Reported-by: Or Gerlitz Signed-off-by: Ziye Yang Change-Id: I83453733f5a3e3350a0461b4cb0bc409fde32fea Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455899 Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- lib/nvme/nvme_tcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/nvme/nvme_tcp.c b/lib/nvme/nvme_tcp.c index 2aa4386a5..b4a184fba 100644 --- a/lib/nvme/nvme_tcp.c +++ b/lib/nvme/nvme_tcp.c @@ -406,7 +406,7 @@ nvme_tcp_qpair_process_send_queue(struct nvme_tcp_qpair *tqpair) } else { SPDK_ERRLOG("spdk_sock_writev() failed, errno %d: %s\n", errno, spdk_strerror(errno)); - return -1; + return -errno; } } @@ -1589,8 +1589,8 @@ nvme_tcp_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_c int rc; rc = nvme_tcp_qpair_process_send_queue(tqpair); - if (rc) { - return 0; + if (rc < 0) { + return rc; } if (max_completions == 0) {