]> www.infradead.org Git - users/dwmw2/linux.git/commit
nvme/multipath: Fix RCU list traversal to use SRCU primitive
authorBreno Leitao <leitao@debian.org>
Tue, 5 Nov 2024 14:42:46 +0000 (06:42 -0800)
committerKeith Busch <kbusch@kernel.org>
Mon, 18 Nov 2024 17:11:24 +0000 (09:11 -0800)
commit5dd18f09ce7399df6fffe80d1598add46c395ae9
tree0b3170c11e3bcf14dd6da6c3b7a23036d8c93d71
parenta3f143c461444c0b56360bbf468615fa814a8372
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.

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