Re: [PATCH] btrfs: extend locking to all space_info members accesses

From: Johannes Thumshirn
Date: Mon Feb 28 2022 - 10:51:51 EST


On 25/02/2022 22:21, Niels Dossche wrote:
> 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.

Maybe also add a lockdep_assert_held() call to need_preemptive_reclaim().

As of now, it has only two callsites which both hold the lock before
accessing bytes_pinned et al, but better safe then sorry.

Anyways,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>