Commit 330581f1 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: disallow ever going rw if nochanges or noreplay

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 4881fdb7
...@@ -378,6 +378,10 @@ int __bch2_fs_read_write(struct bch_fs *c, bool early) ...@@ -378,6 +378,10 @@ int __bch2_fs_read_write(struct bch_fs *c, bool early)
if (test_bit(BCH_FS_RW, &c->flags)) if (test_bit(BCH_FS_RW, &c->flags))
return 0; return 0;
if (c->opts.nochanges ||
c->opts.noreplay)
return -EINVAL;
ret = bch2_fs_mark_dirty(c); ret = bch2_fs_mark_dirty(c);
if (ret) if (ret)
goto err; goto err;
...@@ -684,6 +688,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts) ...@@ -684,6 +688,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
c->opts.nochanges |= c->opts.noreplay; c->opts.nochanges |= c->opts.noreplay;
c->opts.read_only |= c->opts.nochanges; c->opts.read_only |= c->opts.nochanges;
c->opts.read_only |= c->opts.noreplay;
if (bch2_fs_init_fault("fs_alloc")) if (bch2_fs_init_fault("fs_alloc"))
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment