From 2ec99adad90fd8f56d73be5259ec488620d9697c Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Thu, 24 Oct 2019 11:28:59 +0800 Subject: [PATCH] nvmf/tcp: fix the state machine issue if data is already read. Since we use big buffer to read the data, so the incoming data may already be read when the req is waiting for the buffer. So if we use the orginalstatement machine, there will be no read event will be generated again. The quick solution is to restore the original code, since for req which has incapsule data, we not need to wait for the buffer from the shared buffer pool. Signed-off-by: Ziye Yang Change-Id: Ib195d57cc2969235203c34664115c3322d1c9eae Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472047 Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins --- lib/nvmf/tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index bcbbbb15f..fc7ac065f 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -2546,7 +2546,7 @@ spdk_nvmf_tcp_req_process(struct spdk_nvmf_tcp_transport *ttransport, assert(tcp_req->req.xfer != SPDK_NVME_DATA_NONE); - if (&tcp_req->req != STAILQ_FIRST(&group->pending_buf_queue)) { + if (!tcp_req->has_incapsule_data && (&tcp_req->req != STAILQ_FIRST(&group->pending_buf_queue))) { SPDK_DEBUGLOG(SPDK_LOG_NVMF_TCP, "Not the first element to wait for the buf for tcp_req(%p) on tqpair=%p\n", tcp_req, tqpair); @@ -2572,7 +2572,7 @@ spdk_nvmf_tcp_req_process(struct spdk_nvmf_tcp_transport *ttransport, break; } - STAILQ_REMOVE_HEAD(&group->pending_buf_queue, buf_link); + STAILQ_REMOVE(&group->pending_buf_queue, &tcp_req->req, spdk_nvmf_request, buf_link); /* If data is transferring from host to controller, we need to do a transfer from the host. */ if (tcp_req->req.xfer == SPDK_NVME_DATA_HOST_TO_CONTROLLER) {