]> git.hungrycats.org Git - linux/commit
btrfs: add RCU locks around block group initialization
authorMadhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Fri, 6 Mar 2020 06:52:43 +0000 (12:22 +0530)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Tue, 1 Sep 2020 04:40:51 +0000 (00:40 -0400)
commit8413c9d7f312fbcf3ba45792b54c22ea7088ae18
tree7c3de9e873e2b6a7f43e28a16c1bc3e9587aea50
parent832e41d162853d5ba029aadd69ef0238956dfa7c
btrfs: add RCU locks around block group initialization

[ Upstream commit 29566c9c773456467933ee22bbca1c2b72a3506c ]

The space_info list is normally RCU protected and should be traversed
with rcu_read_lock held. There's a warning

  [29.104756] WARNING: suspicious RCU usage
  [29.105046] 5.6.0-rc4-next-20200305 #1 Not tainted
  [29.105231] -----------------------------
  [29.105401] fs/btrfs/block-group.c:2011 RCU-list traversed in non-reader section!!

pointing out that the locking is missing in btrfs_read_block_groups.
However this is not necessary as the list traversal happens at mount
time when there's no other thread potentially accessing the list.

To fix the warning and for consistency let's add the RCU lock/unlock,
the code won't be affected much as it's doing some lightweight
operations.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 7650522178477a5eef85199a73689b5c3409a783)
fs/btrfs/block-group.c