summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-10-11 22:00:44 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-10-11 22:20:51 -0400
commit7d84d9f449f929a3b010cab04a0adc97c7853ab7 (patch)
tree339d86d189f99b0f4f104bd798539265a3fb3e4c /fs
parent3b80552e70573764bbf38b89c58749aef9dd8753 (diff)
downloadlinux-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.c5
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]);