[PATCH v1 0/1] nvme-tcp: fix wrong status on deferred digest error

From: Xixin Liu

Date: Tue Aug 25 2026 - 22:40:02 EST


Hi,

A C2HData digest error stores a host status code in the per-request
status field. Without DATA_SUCCESS the request is completed later from
the rsp path. That path used to pass the stored value straight into
complete, which expects CQE status field encoding and shifts right, so
DATA_XFER_ERROR could be reported as INVALID_FIELD.

This series keeps the per-request status as a host status code. On the
rsp path, shift left when a host error was already stored, otherwise use
the completion status field.

To hit the TCP DATA_XFER_ERROR path without DATA_SUCCESS, enable data
digest and temporarily change the target in
drivers/nvme/target/tcp.c, nvmet_setup_c2h_data_pdu, after the digest
is calculated:

if (queue->data_digest) {
pdu->hdr.flags |= NVME_TCP_F_DDGST;
nvmet_tcp_calc_ddgst(cmd);
cmd->exp_ddgst ^= cpu_to_le32(1);
}

The default target path does not set DATA_SUCCESS on C2HData, so the
host stores the digest error and completes from the later rsp.

Verified on linux-next with an nvmet-tcp loopback target. Unpatched:

nvme nvme0: data digest error: recv 0x2542708 expected 0x2542709
nvme nvme0: Identify Controller failed (2)

Patched:

nvme nvme0: data digest error: recv 0x7ebd5719 expected 0x7ebd5718
nvme nvme0: Identify Controller failed (4)

Status code 0x2 is INVALID_FIELD. Status code 0x4 is DATA_XFER_ERROR.
recv and expected differ by one in both runs.

Thanks,
Xixin Liu

---

Xixin Liu (1):
nvme-tcp: fix wrong status on deferred digest error

drivers/nvme/host/tcp.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

--
2.53.0