[PATCH] nvme: ensure reset state check ordering

Sagi Grimberg sagi at grimberg.me
Mon Nov 20 05:53:59 PST 2023


>> 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?



More information about the Linux-nvme mailing list