[PATCH] nvme/host: Fix RCU list traversal to use SRCU primitive
Keith Busch
kbusch at kernel.org
Mon Nov 4 13:26:37 PST 2024
On Mon, Nov 04, 2024 at 02:16:52PM +0100, Christoph Hellwig wrote:
> On Mon, Nov 04, 2024 at 04:24:40AM -0800, Breno Leitao wrote:
> > The code currently uses list_for_each_entry_rcu() while holding an SRCU
> > lock, triggering false positive warnings with CONFIG_PROVE_RCU=y
> > enabled:
> >
> > drivers/nvme/host/core.c:3770 RCU-list traversed in non-reader section!!
> >
> > While the list is properly protected by SRCU lock, the code uses the wrong
> > list traversal primitive. Replace list_for_each_entry_rcu() with
> > list_for_each_entry_srcu() to correctly indicate SRCU-based protection
> > and eliminate the false warning.
>
> I didn't even know there was such as thing as list_for_each_entry_srcu,
> but apparently it's been there for a while. Looks good:
Neither did I! Thanks Breno, applied to nvme-6.12
More information about the Linux-nvme
mailing list