summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-10-07 18:18:01 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:13 -0400
commit107fe5af562303cda985c6bb72d36dbcd2076f06 (patch)
tree65808601ad43b6f5f4b51451cc0da882197de973 /fs
parent4b09ef12e76c3c0e37ecce6c1e33243d65026398 (diff)
downloadlinux-stable-107fe5af562303cda985c6bb72d36dbcd2076f06.tar.gz
linux-stable-107fe5af562303cda985c6bb72d36dbcd2076f06.tar.bz2
linux-stable-107fe5af562303cda985c6bb72d36dbcd2076f06.zip
bcachefs: Fix a pcpu var splat
this_cpu_ptr() emits a warning when used without preemption disabled - harmless in this case, as we have other locking where bch2_acc_percpu_u64s() is used. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c
index f287bca8498d..8211c9a1b6cb 100644
--- a/fs/bcachefs/util.c
+++ b/fs/bcachefs/util.c
@@ -893,9 +893,14 @@ void eytzinger0_find_test(void)
*/
u64 *bch2_acc_percpu_u64s(u64 __percpu *p, unsigned nr)
{
- u64 *ret = this_cpu_ptr(p);
+ u64 *ret;
int cpu;
+ /* access to pcpu vars has to be blocked by other locking */
+ preempt_disable();
+ ret = this_cpu_ptr(p);
+ preempt_enable();
+
for_each_possible_cpu(cpu) {
u64 *i = per_cpu_ptr(p, cpu);