]> www.infradead.org Git - nvme.git/commit
nvme/multipath: Fix RCU list traversal to use SRCU primitive nvme-6.12 nvme-6.12-2024-11-14
authorBreno Leitao <leitao@debian.org>
Tue, 5 Nov 2024 14:42:46 +0000 (06:42 -0800)
committerKeith Busch <kbusch@kernel.org>
Thu, 7 Nov 2024 21:40:59 +0000 (13:40 -0800)
commitf0f5b364d903a35c02432b0f55d3a0114ba35845
treeb074c2fb2dcdc52220dd3fdf48e54219af4f0ede
parent52ff8e91f916fa05dd47b5c30afa3286c30db444
nvme/multipath: Fix RCU list traversal to use SRCU primitive

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.

Fixes: be647e2c76b2 ("nvme: use srcu for iterating namespace list")
Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/multipath.c