diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-04-02 23:41:10 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:54 -0400 |
commit | ed8269cc1d4107985aa92ade34cd3fe71315dd6a (patch) | |
tree | 10bfad00bae7bbf1a3a819b55af29ec180022e8e /fs/bcachefs/replicas.c | |
parent | 1b05778707d04cb367a7ca8dbeff571b6117a191 (diff) | |
download | linux-ed8269cc1d4107985aa92ade34cd3fe71315dd6a.tar.gz linux-ed8269cc1d4107985aa92ade34cd3fe71315dd6a.tar.bz2 linux-ed8269cc1d4107985aa92ade34cd3fe71315dd6a.zip |
bcachefs: Don't fail mounts due to devices that are marked as failed
If a given set of replicas is entirely on failed devices, don't fail the
mount: we will still fail the mount if we have some copies on non failed
devices.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/replicas.c')
-rw-r--r-- | fs/bcachefs/replicas.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/bcachefs/replicas.c b/fs/bcachefs/replicas.c index 8003973b0400..15ff0d3c936a 100644 --- a/fs/bcachefs/replicas.c +++ b/fs/bcachefs/replicas.c @@ -975,11 +975,18 @@ bool bch2_have_enough_devs(struct bch_fs *c, struct bch_devs_mask devs, percpu_down_read(&c->mark_lock); for_each_cpu_replicas_entry(&c->replicas, e) { - unsigned i, nr_online = 0, dflags = 0; + unsigned i, nr_online = 0, nr_failed = 0, dflags = 0; bool metadata = e->data_type < BCH_DATA_user; - for (i = 0; i < e->nr_devs; i++) + for (i = 0; i < e->nr_devs; i++) { + struct bch_dev *ca = bch_dev_bkey_exists(c, e->devs[i]); + nr_online += test_bit(e->devs[i], devs.d); + nr_failed += ca->mi.state == BCH_MEMBER_STATE_FAILED; + } + + if (nr_failed == e->nr_devs) + continue; if (nr_online < e->nr_required) dflags |= metadata |