OSDN Git Service

nvme-tcp: fix opcode reporting in the timeout handler
authorSagi Grimberg <sagi@grimberg.me>
Mon, 13 Mar 2023 08:56:22 +0000 (10:56 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 15 Mar 2023 13:58:52 +0000 (14:58 +0100)
commita3406352c54fbc476f4f6b98159c3ea1c7dbb6fc
treea650b36ad08ede40544a92f7aa7b0584543d42d9
parentb65d44fa0fe072c91bf41cd8756baa2b4c77eff2
nvme-tcp: fix opcode reporting in the timeout handler

For non in-capsule writes we reuse the request pdu space for a h2cdata
pdu in order to avoid over allocating space (either preallocate or
dynamically upon receving an r2t pdu). However if the request times out
the core expects to find the opcode in the start of the request, which
we override.

In order to prevent that, without sacrificing additional 24 bytes per
request, we just use the tail of the command pdu space instead (last
24 bytes from the 72 bytes command pdu). That should make the command
opcode always available, and we get away from allocating more space.

If in the future we would need the last 24 bytes of the nvme command
available we would need to allocate a dedicated space for it in the
request, but until then we can avoid doing so.

Reported-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <kkch@nvidia.com>
Tested-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/tcp.c