lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260116171653.GB2507766@zen.localdomain>
Date: Fri, 16 Jan 2026 09:16:53 -0800
From: Boris Burkov <boris@....io>
To: Jiasheng Jiang <jiashengjiangcool@...il.com>
Cc: clm@...com, dsterba@...e.com, linux-btrfs@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: remove unnecessary RCU protection in
 clear_incompat_bg_bits

On Fri, Jan 16, 2026 at 04:02:56PM +0000, Jiasheng Jiang wrote:
> The function clear_incompat_bg_bits() currently uses
> list_for_each_entry_rcu() to iterate over the fs_info->space_info list
> without holding the RCU read lock.
> 
> When CONFIG_PROVE_RCU_LIST is enabled, this triggers a false positive
> lockdep warning because the internal check inside the RCU iterator fails:
> 
>   WARNING: suspicious RCU usage
>   -----------------------------
>   fs/btrfs/block-group.c:1014 suspicious rcu_dereference_check() usage!
> 
>   other info that might help us debug this:
> 
>   rcu_scheduler_active = 2, debug_locks = 1
>   1 lock held by ...:
>    #0: ... (sb_internal_sem){.+.+}-{0:0}, at: start_transaction+0x...
> 
> As established in commit 728049050012 ("btrfs: kill the RCU protection
> for fs_info->space_info"), the space_info list is stable (initialized
> upon mount and destroyed during unmount). RCU protection is unnecessary.
> 
> Fix this by switching to the standard list_for_each_entry() iterator,
> which silences the warning.
> 

This version looks good to me, thanks.
Reviewed-by: Boris Burkov <boris@....io>

> Signed-off-by: Jiasheng Jiang <jiashengjiangcool@...il.com>
> ---
>  fs/btrfs/block-group.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
> index 08b14449fabe..d2cb26f130eb 100644
> --- a/fs/btrfs/block-group.c
> +++ b/fs/btrfs/block-group.c
> @@ -1011,7 +1011,7 @@ static void clear_incompat_bg_bits(struct btrfs_fs_info *fs_info, u64 flags)
>  		struct list_head *head = &fs_info->space_info;
>  		struct btrfs_space_info *sinfo;
>  
> -		list_for_each_entry_rcu(sinfo, head, list) {
> +		list_for_each_entry(sinfo, head, list) {
>  			down_read(&sinfo->groups_sem);
>  			if (!list_empty(&sinfo->block_groups[BTRFS_RAID_RAID5]))
>  				found_raid56 = true;
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ