From f0935084bd5de8c6c38c5cdd0c7a788ed3ea0dd6 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 3 May 2022 19:41:18 +0000 Subject: [PATCH] nvmf: set cid when failing a misordered fused command If we don't set the cid before failing the misordered command, we use some other random cid, causing the initiator to think the wrong command was completed. Fixes #2481. For this issue, the target was completing a previously submitted AER, not the fuzzed fused command. The initiator would then submit another AER to replace the completed one, but the target complained that the initiator sent too many AERs since the target didn't really know it had completed an AER so hadn't adjusted its num_aer count. Signed-off-by: Jim Harris Change-Id: I4bd66f147086b262d0e48b8399d237e5ed3c2651 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12452 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Changpeng Liu --- lib/nvmf/tcp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index 8c31ad5f6..86ecf0044 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -2888,6 +2888,7 @@ nvmf_tcp_req_process(struct spdk_nvmf_tcp_transport *ttransport, */ tcp_req->req.rsp->nvme_cpl.status.sct = SPDK_NVME_SCT_GENERIC; tcp_req->req.rsp->nvme_cpl.status.sc = SPDK_NVME_SC_ABORTED_MISSING_FUSED; + tcp_req->req.rsp->nvme_cpl.cid = tcp_req->req.cmd->nvme_cmd.cid; nvmf_tcp_req_set_state(tcp_req, TCP_REQUEST_STATE_READY_TO_COMPLETE); break; }