[PATCH] nvme: ensure reset state check ordering
Christoph Hellwig
hch at lst.de
Mon Oct 30 06:27:38 PDT 2023
On Fri, Oct 27, 2023 at 11:07:52AM -0700, Keith Busch wrote:
> From: Keith Busch <kbusch at kernel.org>
>
> A different CPU may be setting the ctrl->state value while flushing the
> reset work, so ensure proper barriers to prevent reading a stale state.
> Reading the wrong state can report unexpected ENETRESET errors when
> everything was successful.
smp_load_acquire needs to be paired with a smp_store_release.
We should either always hold the lock or use WRITE_ONCE/READ_ONCE
More information about the Linux-nvme
mailing list