From 2da86de69f2a09021ae2abf67cfa54fd87b26b3f Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Thu, 21 Feb 2019 22:39:24 +0800 Subject: [PATCH] nvmf/tcp: fix error message printing in spdk_nvmf_tcp_qpair_set_recv_state If the current recv_state of qpair is same with the state to be set, we will print error message. And checked the current code, we should add a check to avoid this. Change-Id: I49334f637c48e565e785d1fe6d0f000e18b2048a Signed-off-by: Ziye Yang Reviewed-on: https://review.gerrithub.io/c/445653 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/nvmf/tcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index 686f87184..79d1f853a 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -1921,7 +1921,9 @@ spdk_nvmf_tcp_sock_process(struct spdk_nvmf_tcp_qpair *tqpair) return NVME_TCP_PDU_FATAL; } else if (rc > 0) { pdu->ch_valid_bytes += rc; - spdk_nvmf_tcp_qpair_set_recv_state(tqpair, NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_CH); + if (spdk_likely(tqpair->recv_state == NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_READY)) { + spdk_nvmf_tcp_qpair_set_recv_state(tqpair, NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_CH); + } } if (pdu->ch_valid_bytes < sizeof(struct spdk_nvme_tcp_common_pdu_hdr)) {