Skip to content

Commit 7d84d9f

Browse files
author
Kent Overstreet
committed
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 <[email protected]>
1 parent 3b80552 commit 7d84d9f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/bcachefs/replicas.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,11 @@ bool bch2_have_enough_devs(struct bch_fs *c, struct bch_devs_mask devs,
821821

822822
rcu_read_lock();
823823
for (unsigned i = 0; i < e->nr_devs; i++) {
824+
if (e->devs[i] == BCH_SB_MEMBER_INVALID) {
825+
nr_failed++;
826+
continue;
827+
}
828+
824829
nr_online += test_bit(e->devs[i], devs.d);
825830

826831
struct bch_dev *ca = bch2_dev_rcu_noerror(c, e->devs[i]);

0 commit comments

Comments
 (0)