Commit 7d84d9f4 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Fix bch2_have_enough_devs() for BCH_SB_MEMBER_INVALID

This fixes a kasan splat in the ec device removal tests.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 3b80552e
...@@ -821,6 +821,11 @@ bool bch2_have_enough_devs(struct bch_fs *c, struct bch_devs_mask devs, ...@@ -821,6 +821,11 @@ bool bch2_have_enough_devs(struct bch_fs *c, struct bch_devs_mask devs,
rcu_read_lock(); rcu_read_lock();
for (unsigned i = 0; i < e->nr_devs; i++) { for (unsigned i = 0; i < e->nr_devs; i++) {
if (e->devs[i] == BCH_SB_MEMBER_INVALID) {
nr_failed++;
continue;
}
nr_online += test_bit(e->devs[i], devs.d); nr_online += test_bit(e->devs[i], devs.d);
struct bch_dev *ca = bch2_dev_rcu_noerror(c, e->devs[i]); struct bch_dev *ca = bch2_dev_rcu_noerror(c, e->devs[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment