]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: extend locking to all space_info members accesses
authorNiels Dossche <dossche.niels@gmail.com>
Fri, 25 Feb 2022 21:20:28 +0000 (22:20 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Mar 2022 12:13:53 +0000 (13:13 +0100)
commitd719bd2a16ed97e0e47965b877884045a54e58ef
treedf899f32f394187ec9b8206f2ec787b652f7a852
parentbe18a500504bf75a1e6ce7777f783fffc0d1f48d
btrfs: extend locking to all space_info members accesses

bytes_pinned is always accessed under space_info->lock, except in
btrfs_preempt_reclaim_metadata_space, however the other members are
accessed under that lock. The reserved member of the rsv's are also
partially accessed under a lock and partially not. Move all these
accesses into the same lock to ensure consistency.

This could potentially race and lead to a flush instead of a commit but
it's not a big problem as it's only for preemptive flush.

CC: stable@vger.kernel.org # 5.15+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Niels Dossche <niels.dossche@ugent.be>
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/space-info.c