linux/drivers/nvme/host
Sagi Grimberg ba3f445d6d nvme-tcp: fix regression that causes sporadic requests to time out
[ Upstream commit 3770a42bb8 ]

When we queue requests, we strive to batch as much as possible and also
signal the network stack that more data is about to be sent over a socket
with MSG_SENDPAGE_NOTLAST. This flag looks at the pending requests queued
as well as queue->more_requests that is derived from the block layer
last-in-batch indication.

We set more_request=true when we flush the request directly from
.queue_rq submission context (in nvme_tcp_send_all), however this is
wrongly assuming that no other requests may be queued during the
execution of nvme_tcp_send_all.

Due to this, a race condition may happen where:

 1. request X is queued as !last-in-batch
 2. request X submission context calls nvme_tcp_send_all directly
 3. nvme_tcp_send_all is preempted and schedules to a different cpu
 4. request Y is queued as last-in-batch
 5. nvme_tcp_send_all context sends request X+Y, however signals for
    both MSG_SENDPAGE_NOTLAST because queue->more_requests=true.

==> none of the requests is pushed down to the wire as the network
stack is waiting for more data, both requests timeout.

To fix this, we eliminate queue->more_requests and only rely on
the queue req_list and send_list to be not-empty.

Fixes: 122e5b9f3d ("nvme-tcp: optimize network stack with setting msg flags according to batch size")
Reported-by: Jonathan Nicklin <jnicklin@blockbridge.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Tested-by: Jonathan Nicklin <jnicklin@blockbridge.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2022-09-15 10:47:16 +02:00
..
apple.c nvme-apple: fix sparse endianess warnings 2022-05-06 21:06:25 +02:00
constants.c nvme: add support for TP4084 - Time-to-Ready Enhancements 2022-05-18 18:54:17 +02:00
core.c nvme: catch -ENODEV from nvme_revalidate_zones again 2022-08-17 15:15:42 +02:00
fabrics.c nvme-fabrics: remove unnecessary braces for case 2022-02-28 13:45:04 +02:00
fabrics.h nvme-fabrics: add a request timeout helper 2022-05-16 08:07:25 +02:00
fault_inject.c block: remove the ->rq_disk field in struct request 2021-11-29 06:41:29 -07:00
fc.c nvme-fc: fix the fc_appid_store return value 2022-08-25 11:45:25 +02:00
fc.h nvme-fc: Update header and host for common definitions for LS handling 2020-05-09 16:18:33 -06:00
hwmon.c nvme-hwmon: Return error code when registration fails 2021-03-05 13:41:03 +01:00
ioctl.c blk-mq: remove the done argument to blk_execute_rq_nowait 2022-05-28 06:15:27 -06:00
Kconfig nvme-apple: Add initial Apple SoC NVMe driver 2022-05-02 17:24:45 +02:00
Makefile nvme-apple: Add initial Apple SoC NVMe driver 2022-05-02 17:24:45 +02:00
multipath.c nvme: define compat_ioctl again to unbreak 32-bit userspace. 2022-08-17 15:15:42 +02:00
nvme.h nvme: fix regression when disconnect a recovering ctrl 2022-06-29 16:13:45 +02:00
pci.c nvme-pci: Crucial P2 has bogus namespace ids 2022-07-25 07:34:07 +02:00
rdma.c nvme: fix regression when disconnect a recovering ctrl 2022-06-29 16:13:45 +02:00
tcp.c nvme-tcp: fix regression that causes sporadic requests to time out 2022-09-15 10:47:16 +02:00
trace.c nvme: add set feature tracing support 2021-08-16 14:42:23 +02:00
trace.h nvme: use command_id instead of req->tag in trace_nvme_complete_rq() 2022-08-17 15:15:42 +02:00
zns.c nvme: report write pointer for a full zone as zone start + zone len 2021-12-06 08:52:08 +01:00