summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-04-05 00:18:52 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2019-04-05 00:20:57 -0400
commit4681c31c9e1c0d90ad8e214af0005e31b71248ad (patch)
tree482e9a797700a46c1a2814185569fa9a6c35c0e5
parent6355f81872054d8e06bd0d1c8543fb76f5c6a8e8 (diff)
bcachefs: disallow ever going rw if nochanges or noreplay
-rw-r--r--fs/bcachefs/super.c5
1 files changed, 5 insertions, 0 deletions
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;