nvme: ensure reset state check ordering
authorKeith Busch <kbusch@kernel.org>
Fri, 27 Oct 2023 17:58:12 +0000 (10:58 -0700)
committerKeith Busch <kbusch@kernel.org>
Mon, 4 Dec 2023 16:39:03 +0000 (08:39 -0800)
commite6e7f7ac03e40795346f1b2994a05f507ad8d345
tree3e48f621f67d05ce07d4c6f71b6ac16a1f346206
parent5c687c287c46fadb14644091823298875a5216aa
nvme: ensure reset state check ordering

A different CPU may be setting the ctrl->state value, so ensure proper
barriers to prevent optimizing to a stale state. Normally it isn't a
problem to observe the wrong state as it is merely advisory to take a
quicker path during initialization and error recovery, but seeing an old
state can report unexpected ENETRESET errors when a reset request was in
fact successful.

Reported-by: Minh Hoang <mh2022@meta.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
drivers/nvme/host/core.c
drivers/nvme/host/fc.c
drivers/nvme/host/pci.c
drivers/nvme/host/rdma.c
drivers/nvme/host/tcp.c