aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/dev-replace.c
diff options
context:
space:
mode:
authorFilipe Manana <[email protected]>2025-02-24 15:40:26 +0000
committerDavid Sterba <[email protected]>2025-03-18 19:35:47 +0000
commitba5d06440cae63edc4f49465baf78f1f43e55c77 (patch)
tree87fef0d0d6327d1e21267dbfdc9d88aa9083165c /fs/btrfs/dev-replace.c
parentbtrfs: get zone unusable bytes while holding lock at btrfs_reclaim_bgs_work() (diff)
downloadkernel-ba5d06440cae63edc4f49465baf78f1f43e55c77.tar.gz
kernel-ba5d06440cae63edc4f49465baf78f1f43e55c77.zip
btrfs: get used bytes while holding lock at btrfs_reclaim_bgs_work()
At btrfs_reclaim_bgs_work(), we are grabbing twice the used bytes counter of the block group while not holding the block group's spinlock. This can result in races, reported by KCSAN and similar tools, since a concurrent task can be updating that counter while at btrfs_update_block_group(). So avoid these races by grabbing the counter in a critical section delimited by the block group's spinlock after setting the block group to RO mode. This also avoids using two different values of the counter in case it changes in between each read. This silences KCSAN and is required for the next patch in the series too. Fixes: 243192b67649 ("btrfs: report reclaim stats in sysfs") Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
0 files changed, 0 insertions, 0 deletions