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

From: Keith Busch
Date: Thu Nov 07 2024 - 16:38:03 EST


On Tue, Nov 05, 2024 at 06:42:46AM -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/multipath.c:168 RCU-list traversed in non-reader section!!
> drivers/nvme/host/multipath.c:227 RCU-list traversed in non-reader section!!
> drivers/nvme/host/multipath.c:260 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.

Thanks, applied to nvme-6.12. Sorry I missed this was posted until after
I'd sent this week's pull request, but this will make the next one.