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-next>] [day] [month] [year] [list]
Message-Id: <20220228225215.16552-1-dossche.niels@gmail.com>
Date:   Mon, 28 Feb 2022 23:52:16 +0100
From:   Niels Dossche <dossche.niels@...il.com>
To:     linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
        David Sterba <dsterba@...e.com>,
        Niels Dossche <dossche.niels@...il.com>,
        Johannes Thumshirn <johannes.thumshirn@....com>
Subject: [PATCH] btrfs: add lockdep_assert_held to need_preemptive_reclaim

In a previous patch I extended the locking for member accesses of
space_info. It was then suggested to also add a lockdep assertion for
space_info->lock to need_preemptive_reclaim.

Suggested-by: Johannes Thumshirn <johannes.thumshirn@....com>
Signed-off-by: Niels Dossche <dossche.niels@...il.com>
---
 fs/btrfs/space-info.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index 294242c194d8..5464bd168d5b 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -734,9 +734,13 @@ static bool need_preemptive_reclaim(struct btrfs_fs_info *fs_info,
 {
 	u64 global_rsv_size = fs_info->global_block_rsv.reserved;
 	u64 ordered, delalloc;
-	u64 thresh = div_factor_fine(space_info->total_bytes, 90);
+	u64 thresh;
 	u64 used;
 
+	lockdep_assert_held(&space_info->lock);
+
+	thresh = div_factor_fine(space_info->total_bytes, 90);
+
 	/* If we're just plain full then async reclaim just slows us down. */
 	if ((space_info->bytes_used + space_info->bytes_reserved +
 	     global_rsv_size) >= thresh)
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ