aboutsummaryrefslogtreecommitdiff
path: root/fs/bcachefs/super-io.c
diff options
context:
space:
mode:
authorGravatar Kent Overstreet <kent.overstreet@gmail.com> 2021-04-09 19:04:57 -0400
committerGravatar Kent Overstreet <kent.overstreet@linux.dev> 2023-10-22 17:08:54 -0400
commit98f2197de49b8eb038909e709c79c13178022dda (patch)
treede6ad658400234072123a313d0859c40a95c37f6 /fs/bcachefs/super-io.c
parentbcachefs: Don't fail mounts due to devices that are marked as failed (diff)
downloadlinux-98f2197de49b8eb038909e709c79c13178022dda.tar.gz
linux-98f2197de49b8eb038909e709c79c13178022dda.tar.bz2
linux-98f2197de49b8eb038909e709c79c13178022dda.zip
bcachefs: Fix bch2_write_super to obey very_degraded option
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super-io.c')
-rw-r--r--fs/bcachefs/super-io.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index ce370cf2a72f..776c026ac838 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -699,8 +699,12 @@ int bch2_write_super(struct bch_fs *c)
const char *err;
struct bch_devs_mask sb_written;
bool wrote, can_mount_without_written, can_mount_with_written;
+ unsigned degraded_flags = BCH_FORCE_IF_DEGRADED;
int ret = 0;
+ if (c->opts.very_degraded)
+ degraded_flags |= BCH_FORCE_IF_LOST;
+
lockdep_assert_held(&c->sb_lock);
closure_init_stack(cl);
@@ -769,13 +773,13 @@ int bch2_write_super(struct bch_fs *c)
nr_wrote = dev_mask_nr(&sb_written);
can_mount_with_written =
- bch2_have_enough_devs(c, sb_written, BCH_FORCE_IF_DEGRADED, false);
+ bch2_have_enough_devs(c, sb_written, degraded_flags, false);
for (i = 0; i < ARRAY_SIZE(sb_written.d); i++)
sb_written.d[i] = ~sb_written.d[i];
can_mount_without_written =
- bch2_have_enough_devs(c, sb_written, BCH_FORCE_IF_DEGRADED, false);
+ bch2_have_enough_devs(c, sb_written, degraded_flags, false);
/*
* If we would be able to mount _without_ the devices we successfully