Skip to content

Commit 6f692b1

Browse files
author
Kent Overstreet
committed
bcachefs: Fix RCU splat
Reported-by: [email protected] Signed-off-by: Kent Overstreet <[email protected]>
1 parent 7d7f71c commit 6f692b1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

fs/bcachefs/buckets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ int bch2_bucket_ref_update(struct btree_trans *trans, struct bch_dev *ca,
805805
"bucket %u:%zu gen %u (mem gen %u) data type %s: stale dirty ptr (gen %u)\n"
806806
"while marking %s",
807807
ptr->dev, bucket_nr, b_gen,
808-
*bucket_gen(ca, bucket_nr),
808+
bucket_gen_get(ca, bucket_nr),
809809
bch2_data_type_str(bucket_data_type ?: ptr_data_type),
810810
ptr->gen,
811811
(printbuf_reset(&buf),

fs/bcachefs/buckets.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ static inline u8 *bucket_gen(struct bch_dev *ca, size_t b)
116116
return gens->b + b;
117117
}
118118

119+
static inline u8 bucket_gen_get(struct bch_dev *ca, size_t b)
120+
{
121+
rcu_read_lock();
122+
u8 gen = *bucket_gen(ca, b);
123+
rcu_read_unlock();
124+
return gen;
125+
}
126+
119127
static inline size_t PTR_BUCKET_NR(const struct bch_dev *ca,
120128
const struct bch_extent_ptr *ptr)
121129
{

0 commit comments

Comments
 (0)