[PATCH v2 3/5] nvme-auth: fix data race on ctrl->transaction
Guixin Liu
kanie at linux.alibaba.com
Mon Nov 9 18:34:24 PST 2026
在 2026/11/10 01:10, Keith Busch 写道:
> On Mon, Nov 09, 2026 at 10:26:44AM +0800, Guixin Liu wrote:
>> The controller side only echoes the transaction id within a queue, so
>> the race has no functional impact today, but the increment is still
>> unsynchronized and KCSAN reports it.
> So it's not a bug with any user observable behavior; it's just
> unexpected. It sounds like the "transaction" value doesn't need to be
> unique across queues. If it doesn't need to be unique at the "ctrl"
> scope, then I'm not seeing any benefit to imposing that rule on the
> driver.
>
>> - chap->transaction = ctrl->transaction++;
>> + chap->transaction = (u16)atomic_inc_return(&ctrl->transaction);
> Can we just change this to:
>
> chap->transaction++;
>
> ? And delete the value reset in nvme_auth_reset_dhchap? You can also
> delete the "transaction" field from the nvme_ctrl struct.
This make sense, changed in v3.
Best Regards,
Guixin Liu
More information about the Linux-nvme
mailing list