From 4681c31c9e1c0d90ad8e214af0005e31b71248ad Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Fri, 5 Apr 2019 00:18:52 -0400 Subject: bcachefs: disallow ever going rw if nochanges or noreplay --- fs/bcachefs/super.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 9dc201ab095f..920bbfbb47bf 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -409,6 +409,10 @@ int __bch2_fs_read_write(struct bch_fs *c, bool early) if (test_bit(BCH_FS_RW, &c->flags)) return 0; + if (c->opts.nochanges || + c->opts.noreplay) + return -EINVAL; + ret = bch2_fs_mark_dirty(c); if (ret) goto err; @@ -716,6 +720,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts) c->opts.nochanges |= c->opts.noreplay; c->opts.read_only |= c->opts.nochanges; + c->opts.read_only |= c->opts.noreplay; if (bch2_fs_init_fault("fs_alloc")) goto err; -- cgit v1.2.3