[PATCH] nvme/host: Fix RCU list traversal to use SRCU primitive

Christoph Hellwig hch at lst.de
Mon Nov 4 05:16:52 PST 2024


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:

Reviewed-by: Christoph Hellwig <hch at lst.de>

> Something similar will need to be done for multipath. I will get it done
> once I get some feedback about this patch first.

Thanks!




More information about the Linux-nvme mailing list