diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-10-11 22:00:44 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-10-11 22:20:51 -0400 |
commit | 7d84d9f449f929a3b010cab04a0adc97c7853ab7 (patch) | |
tree | 339d86d189f99b0f4f104bd798539265a3fb3e4c /fs | |
parent | 3b80552e70573764bbf38b89c58749aef9dd8753 (diff) | |
download | linux-stable-7d84d9f449f929a3b010cab04a0adc97c7853ab7.tar.gz linux-stable-7d84d9f449f929a3b010cab04a0adc97c7853ab7.tar.bz2 linux-stable-7d84d9f449f929a3b010cab04a0adc97c7853ab7.zip |
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: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/replicas.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/bcachefs/replicas.c b/fs/bcachefs/replicas.c index 797da1032318..477ef0997949 100644 --- a/fs/bcachefs/replicas.c +++ b/fs/bcachefs/replicas.c @@ -821,6 +821,11 @@ bool bch2_have_enough_devs(struct bch_fs *c, struct bch_devs_mask devs, rcu_read_lock(); 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); struct bch_dev *ca = bch2_dev_rcu_noerror(c, e->devs[i]); |