From nobody Mon Sep 28 05:45:29 2026 Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79BCB2DECD3 for ; Wed, 26 Aug 2026 02:39:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787712001; cv=none; b=nrYM5RhbobQh7JghlRMIqMX3vW3FwzzsO6nTKWyTk5I3rkNV2xQL5jIIXllPu6CnV8zOjcv5ofp7EXVuQ167ldgBnfiPWBaMJq8evFb5azVMrU10ocNgQDIYH/vCjTxz3RgNA2vDn6pEVSrznXxlFl7qj9k25L0jIQWtUMLpExc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787712001; c=relaxed/simple; bh=SWfOt7Yp8oEQO/zIeEOYw38FP5U7r7qOY9sgcnc0HFs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VKVGtq//ea/dMRT5DvC0eJgxZoR/FuuBYJRKMK/n4JyhpO3yGpJelECvRxGFiExFVMhGID8SG5cc0TY4EZp7QZ0JKQMu4FawS11W5dFLKojsfgXvcYqyjSqim06S43SiBm4aH5jIE3cmZMFxffD83mKi6JTjxkeey5NqLyVbWXk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 6a384244a0f711f19a56ed5b684f684d-20260826 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.19,REQID:503eab99-a663-407b-99e0-98ec1f88c197,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-25 X-CID-META: VersionHash:7db8b62,CLOUDID:89da1cd6a5f991a5a628ca4ea9752b2c,BulkI D:nil,BulkQuantity:0,SF:81|82|102|865|898,TC:nil,Content:0|15|50,EDM:-3,IP :nil,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0, LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 6a384244a0f711f19a56ed5b684f684d-20260826 X-User: liuxixin@kylinos.cn Received: from [127.0.1.1] [(10.44.16.150)] by mailgw.kylinos.cn (envelope-from ) (Generic MTA with TLSv1.3 TLS_AES_256_GCM_SHA384 256/256) with ESMTP id 229579736; Wed, 26 Aug 2026 10:39:52 +0800 From: Xixin Liu To: linux-nvme@lists.infradead.org Cc: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me, hare@suse.de, dwagner@suse.de, linux-kernel@vger.kernel.org, liuxixin@kylinos.cn Subject: [PATCH v1 1/1] nvme-tcp: fix wrong status on deferred digest error Date: Wed, 26 Aug 2026 09:30:00 +0800 Message-ID: <1.nvme-tcp-req-status.v1.git.liuxixin@kylinos.cn> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: patches/scripts/send-local.py Content-Type: text/plain; charset="utf-8" A C2HData digest error stores a host status code in req status. Without DATA_SUCCESS the request is completed later from the rsp path, which passed that value straight into complete and could report the wrong status code. Keep req 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. Fixes: 1ba2e507f55c ("nvme-tcp: Do not reset transport on data digest error= s") Signed-off-by: Xixin Liu --- drivers/nvme/host/tcp.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) --- a/drivers/nvme/host/tcp.c 2026-08-26 09:24:50.988099281 +0800 +++ b/drivers/nvme/host/tcp.c 2026-08-26 09:25:12.474510519 +0800 @@ -73,7 +73,7 @@ u32 h2cdata_left; u32 h2cdata_offset; u16 ttag; - __le16 status; + u16 status; struct list_head entry; struct llist_node lentry; __le32 ddgst; @@ -617,6 +617,7 @@ { struct nvme_tcp_request *req; struct request *rq; + __le16 status; =20 rq =3D nvme_find_rq(nvme_tcp_tagset(queue), cqe->command_id); if (!rq) { @@ -628,10 +629,12 @@ } =20 req =3D blk_mq_rq_to_pdu(rq); - if (req->status =3D=3D cpu_to_le16(NVME_SC_SUCCESS)) - req->status =3D cqe->status; + if (req->status !=3D NVME_SC_SUCCESS) + status =3D cpu_to_le16(req->status << 1); + else + status =3D cqe->status; =20 - if (!nvme_try_complete_req(rq, req->status, cqe->result)) + if (!nvme_try_complete_req(rq, status, cqe->result)) nvme_complete_rq(rq); queue->nr_cqe++; =20 @@ -961,8 +964,7 @@ queue->ddgst_remaining =3D NVME_TCP_DIGEST_LENGTH; } else { if (pdu->hdr.flags & NVME_TCP_F_DATA_SUCCESS) { - nvme_tcp_end_request(rq, - le16_to_cpu(req->status)); + nvme_tcp_end_request(rq, req->status); queue->nr_cqe++; } nvme_tcp_init_recv_ctx(queue); @@ -996,7 +998,7 @@ pdu->command_id); struct nvme_tcp_request *req =3D blk_mq_rq_to_pdu(rq); =20 - req->status =3D cpu_to_le16(NVME_SC_DATA_XFER_ERROR); + req->status =3D NVME_SC_DATA_XFER_ERROR; =20 dev_err(queue->ctrl->ctrl.device, "data digest error: recv %#x expected %#x\n", @@ -1009,7 +1011,7 @@ pdu->command_id); struct nvme_tcp_request *req =3D blk_mq_rq_to_pdu(rq); =20 - nvme_tcp_end_request(rq, le16_to_cpu(req->status)); + nvme_tcp_end_request(rq, req->status); queue->nr_cqe++; } =20 @@ -2733,7 +2735,7 @@ return ret; =20 req->state =3D NVME_TCP_SEND_CMD_PDU; - req->status =3D cpu_to_le16(NVME_SC_SUCCESS); + req->status =3D NVME_SC_SUCCESS; req->offset =3D 0; req->data_sent =3D 0; req->pdu_len =3D 0; --=20 2.53.0