* [PATCH] nvme-tcp: return -EPROTO for a C2HData on a write
@ 2026-08-23 7:46 Yehyeong Lee
2026-08-23 8:04 ` Sagi Grimberg
2026-08-25 0:58 ` Keith Busch
0 siblings, 2 replies; 3+ messages in thread
From: Yehyeong Lee @ 2026-08-23 7:46 UTC (permalink / raw)
To: kbusch; +Cc: sagi, hch, axboe, linux-nvme, Yehyeong Lee
The direction check in nvme_tcp_handle_c2h_data() returns -EIO. A
C2HData PDU naming a command that did not ask for data is a protocol
violation, and the check that rejects a PDU on those grounds a few
lines below it - SUCCESS set without LAST - returns -EPROTO.
No caller distinguishes the two, so this changes the error code alone.
Suggested-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
---
Measured on the test target: a write answered with C2HData changes the
log line from "receive failed: -5" to "-71", and the neighbouring
payload check still reports -5. Three runs each way.
Applies on top of "nvme-tcp: check the data direction of a C2HData PDU"
in nvme-7.3; squash into it if you prefer. No Fixes: tag because that
commit has no upstream hash yet.
drivers/nvme/host/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index a62d6e48f7190..a865bd0688543 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -683,7 +683,7 @@ static int nvme_tcp_handle_c2h_data(struct nvme_tcp_queue *queue,
dev_err(queue->ctrl->ctrl.device,
"queue %d tag %#x unexpected data for a write\n",
nvme_tcp_queue_id(queue), rq->tag);
- return -EIO;
+ return -EPROTO;
}
req = blk_mq_rq_to_pdu(rq);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-tcp: return -EPROTO for a C2HData on a write
2026-08-23 7:46 [PATCH] nvme-tcp: return -EPROTO for a C2HData on a write Yehyeong Lee
@ 2026-08-23 8:04 ` Sagi Grimberg
2026-08-25 0:58 ` Keith Busch
1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2026-08-23 8:04 UTC (permalink / raw)
To: Yehyeong Lee, kbusch; +Cc: hch, axboe, linux-nvme
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-tcp: return -EPROTO for a C2HData on a write
2026-08-23 7:46 [PATCH] nvme-tcp: return -EPROTO for a C2HData on a write Yehyeong Lee
2026-08-23 8:04 ` Sagi Grimberg
@ 2026-08-25 0:58 ` Keith Busch
1 sibling, 0 replies; 3+ messages in thread
From: Keith Busch @ 2026-08-25 0:58 UTC (permalink / raw)
To: Yehyeong Lee; +Cc: sagi, hch, axboe, linux-nvme
On Sun, Aug 23, 2026 at 04:46:16PM +0900, Yehyeong Lee wrote:
> The direction check in nvme_tcp_handle_c2h_data() returns -EIO. A
> C2HData PDU naming a command that did not ask for data is a protocol
> violation, and the check that rejects a PDU on those grounds a few
> lines below it - SUCCESS set without LAST - returns -EPROTO.
>
Thanks, applied to nvme-7.3.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-25 0:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-23 7:46 [PATCH] nvme-tcp: return -EPROTO for a C2HData on a write Yehyeong Lee
2026-08-23 8:04 ` Sagi Grimberg
2026-08-25 0:58 ` Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox