[PATCH] nvme: ensure reset state check ordering

Christoph Hellwig hch at lst.de
Mon Nov 20 06:26:48 PST 2023


On Mon, Nov 20, 2023 at 03:53:59PM +0200, Sagi Grimberg 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
>
> which lock?

in this case: ctrl->lock.



More information about the Linux-nvme mailing list