diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-03-21 23:13:46 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:18 -0400 |
commit | 03e183cb5d429a3bb53816d70da7c19f0745909e (patch) | |
tree | 76b1c8fd41a84cfc544dca8872faa1d516ca5b17 /fs/bcachefs/super.c | |
parent | 134915f3d38d830374603b84a9fe2e280f4814ed (diff) | |
download | lwn-03e183cb5d429a3bb53816d70da7c19f0745909e.tar.gz lwn-03e183cb5d429a3bb53816d70da7c19f0745909e.zip |
bcachefs: Verify fs hasn't been modified before going rw
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r-- | fs/bcachefs/super.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 5364b95cfec9..dd1496af9a06 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -366,7 +366,7 @@ static int bch2_fs_read_write_late(struct bch_fs *c) return 0; } -static int __bch2_fs_read_write(struct bch_fs *c, bool early) +int __bch2_fs_read_write(struct bch_fs *c, bool early) { struct bch_dev *ca; unsigned i; @@ -907,6 +907,7 @@ static void bch2_dev_free(struct bch_dev *ca) free_percpu(ca->io_done); bioset_exit(&ca->replica_set); bch2_dev_buckets_free(ca); + kfree(ca->sb_read_scratch); bch2_time_stats_exit(&ca->io_latency[WRITE]); bch2_time_stats_exit(&ca->io_latency[READ]); @@ -1017,6 +1018,7 @@ static struct bch_dev *__bch2_dev_alloc(struct bch_fs *c, 0, GFP_KERNEL) || percpu_ref_init(&ca->io_ref, bch2_dev_io_ref_complete, PERCPU_REF_INIT_DEAD, GFP_KERNEL) || + !(ca->sb_read_scratch = kmalloc(4096, GFP_KERNEL)) || bch2_dev_buckets_alloc(c, ca) || bioset_init(&ca->replica_set, 4, offsetof(struct bch_write_bio, bio), 0) || |