linux/drivers/nvme/host
Yu Kuai da1a85e32e nvme: fix misaccounting of nvme-mpath inflight I/O
[ Upstream commit 71257925e8 ]

Procedures for nvme-mpath IO accounting:

 1) initialize nvme_request and clear flags;
 2) set NVME_MPATH_IO_STATS and increase inflight counter when IO
    started;
 3) check NVME_MPATH_IO_STATS and decrease inflight counter when IO is
    done;

However, for the case nvme_fail_nonready_command(), both step 1) and 2)
are skipped, and if old nvme_request set NVME_MPATH_IO_STATS and then
request is reused, step 3) will still be executed, causing inflight I/O
counter to be negative.

Fix the problem by clearing nvme_request in nvme_fail_nonready_command().

Fixes: ea5e5f42cd ("nvme-fabrics: avoid double completions in nvmf_fail_nonready_command")
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Closes: https://lore.kernel.org/all/CAHj4cs_+dauobyYyP805t33WMJVzOWj=7+51p4_j9rA63D9sog@mail.gmail.com/
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-07-24 08:51:52 +02:00
..
apple.c nvme-apple: only reset the controller when RTKit is running 2023-02-06 08:06:34 +01:00
auth.c nvme-auth: set explanation code for failure2 msgs 2023-12-20 17:00:22 +01:00
constants.c nvme: fix the name of Zone Append for verbose logging 2023-06-09 10:34:04 +02:00
core.c nvme: fix misaccounting of nvme-mpath inflight I/O 2025-07-24 08:51:52 +02:00
fabrics.c nvme: consider also host_iface when checking ip options 2022-09-19 17:55:24 +02:00
fabrics.h nvme: fix reconnection fail due to reserved tag allocation 2024-03-26 18:20:59 -04: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: go straight to connecting state when initializing 2025-03-28 21:58:50 +01: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-pci: add quirk for missing secondary temperature thresholds 2023-06-09 10:34:09 +02:00
ioctl.c nvme: always punt polled uring_cmd end_io work to task_work 2025-07-06 10:58:04 +02:00
Kconfig nvme-auth: Diffie-Hellman key exchange support 2022-08-02 17:14:49 -06:00
Makefile nvme: don't always build constants.o 2022-08-02 17:22:48 -06:00
multipath.c nvme-multipath: defer partition scanning 2024-11-17 15:07:20 +01:00
nvme.h nvme-multipath: defer partition scanning 2024-11-17 15:07:20 +01:00
pci.c nvme-pci: add NVME_QUIRK_NO_DEEPEST_PS quirk for SOLIDIGM P44 Pro 2025-06-04 14:40:26 +02:00
rdma.c nvme-rdma: do not try to stop unallocated queues 2023-10-25 12:03:14 +02:00
tcp.c nvme-tcp: fix premature queue removal and I/O failover 2025-05-09 09:41:41 +02:00
trace.c nvme: implement In-Band authentication 2022-08-02 17:14:49 -06:00
trace.h nvme: fix async event trace event 2023-05-11 23:03:22 +09:00
zns.c block: pass a gendisk to blk_queue_max_open_zones and blk_queue_max_active_zones 2022-07-06 06:46:26 -06:00