mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
bcachefs: Fix rcu splat in check_fix_ptrs()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
eb6a9339ef
commit
427ba55503
1 changed files with 6 additions and 5 deletions
|
@ -479,9 +479,8 @@ int bch2_check_fix_ptrs(struct btree_trans *trans,
|
|||
|
||||
percpu_down_read(&c->mark_lock);
|
||||
|
||||
rcu_read_lock();
|
||||
bkey_for_each_ptr_decode(k.k, ptrs_c, p, entry_c) {
|
||||
struct bch_dev *ca = bch2_dev_rcu(c, p.ptr.dev);
|
||||
struct bch_dev *ca = bch2_dev_tryget(c, p.ptr.dev);
|
||||
if (!ca) {
|
||||
if (fsck_err(c, ptr_to_invalid_device,
|
||||
"pointer to missing device %u\n"
|
||||
|
@ -558,7 +557,7 @@ int bch2_check_fix_ptrs(struct btree_trans *trans,
|
|||
do_update = true;
|
||||
|
||||
if (data_type != BCH_DATA_btree && p.ptr.gen != g->gen)
|
||||
continue;
|
||||
goto next;
|
||||
|
||||
if (fsck_err_on(bucket_data_type_mismatch(g->data_type, data_type),
|
||||
c, ptr_bucket_data_type_mismatch,
|
||||
|
@ -601,8 +600,9 @@ int bch2_check_fix_ptrs(struct btree_trans *trans,
|
|||
bch2_bkey_val_to_text(&buf, c, k), buf.buf)))
|
||||
do_update = true;
|
||||
}
|
||||
next:
|
||||
bch2_dev_put(ca);
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
if (do_update) {
|
||||
if (flags & BTREE_TRIGGER_is_root) {
|
||||
|
@ -638,9 +638,10 @@ int bch2_check_fix_ptrs(struct btree_trans *trans,
|
|||
} else {
|
||||
struct bkey_ptrs ptrs;
|
||||
union bch_extent_entry *entry;
|
||||
|
||||
rcu_read_lock();
|
||||
restart_drop_ptrs:
|
||||
ptrs = bch2_bkey_ptrs(bkey_i_to_s(new));
|
||||
rcu_read_lock();
|
||||
bkey_for_each_ptr_decode(bkey_i_to_s(new).k, ptrs, p, entry) {
|
||||
struct bch_dev *ca = bch2_dev_rcu(c, p.ptr.dev);
|
||||
struct bucket *g = PTR_GC_BUCKET(ca, &p.ptr);
|
||||
|
|
Loading…
Reference in a new issue