summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-04-05 07:18:52 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:08:20 +0300
commit330581f16f3041e7cd4e4d8c3b7a569d663a8035 (patch)
treec2cbf73a95bd4497b42511499783b1995c5e7280
parent4881fdb7566dcc52aaf05f9b8f044a5ecfeff81b (diff)
downloadlinux-330581f16f3041e7cd4e4d8c3b7a569d663a8035.tar.xz
bcachefs: disallow ever going rw if nochanges or noreplay
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-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 27eacb1cd144..85a9400a47fc 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -378,6 +378,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;
@@ -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.read_only |= c->opts.nochanges;
+ c->opts.read_only |= c->opts.noreplay;
if (bch2_fs_init_fault("fs_alloc"))
goto err;