summaryrefslogtreecommitdiff
path: root/certs/system_keyring.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2024-07-08 15:42:45 +0100
committerDavid Sterba <dsterba@suse.com>2024-07-11 16:50:54 +0200
commit4484940514295b75389f94787f8e179ba6255353 (patch)
tree68de671f64cdfaa2309c83e3d76e358acaa481b9 /certs/system_keyring.c
parentb3ebb9b7e92a928344a7a2c1f8514474bfa113cf (diff)
btrfs: avoid races when tracking progress for extent map shrinking
We store the progress (root and inode numbers) of the extent map shrinker in fs_info without any synchronization but we can have multiple tasks calling into the shrinker during memory allocations when there's enough memory pressure for example. This can result in a task A reading fs_info->extent_map_shrinker_last_ino after another task B updates it, and task A reading fs_info->extent_map_shrinker_last_root before task B updates it, making task A see an odd state that isn't necessarily harmful but may make it skip certain inode ranges or do more work than necessary by going over the same inodes again. These unprotected accesses would also trigger warnings from tools like KCSAN. So add a lock to protect access to these progress fields. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'certs/system_keyring.c')
0 files changed, 0 insertions, 0 deletions