diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-09 15:16:50 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-09 15:25:40 -0400 |
commit | 5d507f795b0b679a67e972a48cbd0854c4ad0f02 (patch) | |
tree | bf30f9dd1badd504025e836d696d4d2d939108c3 /libbcachefs/super.c | |
parent | c99a444c5cc242a89845be83236aacd7db628ef5 (diff) |
Update bcachefs sources to da7d42a9a2 bcachefs: Add new assertions for shutdown path
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/super.c')
-rw-r--r-- | libbcachefs/super.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/libbcachefs/super.c b/libbcachefs/super.c index 6fa805cb..426d2acf 100644 --- a/libbcachefs/super.c +++ b/libbcachefs/super.c @@ -361,20 +361,21 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early) if (test_bit(BCH_FS_INITIAL_GC_UNFIXED, &c->flags)) { bch_err(c, "cannot go rw, unfixed btree errors"); - return -EROFS; + return -BCH_ERR_erofs_unfixed_errors; } if (test_bit(BCH_FS_RW, &c->flags)) return 0; + if (c->opts.norecovery) + return -BCH_ERR_erofs_norecovery; + /* * nochanges is used for fsck -n mode - we have to allow going rw * during recovery for that to work: */ - if (c->opts.norecovery || - (c->opts.nochanges && - (!early || c->opts.read_only))) - return -EROFS; + if (c->opts.nochanges && (!early || c->opts.read_only)) + return -BCH_ERR_erofs_nochanges; bch_info(c, "going read-write"); @@ -653,8 +654,6 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts) unsigned i, iter_size; int ret = 0; - pr_verbose_init(opts, ""); - c = kvpmalloc(sizeof(struct bch_fs), GFP_KERNEL|__GFP_ZERO); if (!c) { c = ERR_PTR(-BCH_ERR_ENOMEM_fs_alloc); @@ -865,7 +864,6 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts) if (ret) goto err; out: - pr_verbose_init(opts, "ret %i", PTR_ERR_OR_ZERO(c)); return c; err: bch2_fs_free(c); @@ -1181,8 +1179,6 @@ static int bch2_dev_alloc(struct bch_fs *c, unsigned dev_idx) struct bch_dev *ca = NULL; int ret = 0; - pr_verbose_init(c->opts, ""); - if (bch2_fs_init_fault("dev_alloc")) goto err; @@ -1193,14 +1189,11 @@ static int bch2_dev_alloc(struct bch_fs *c, unsigned dev_idx) ca->fs = c; bch2_dev_attach(c, ca, dev_idx); -out: - pr_verbose_init(c->opts, "ret %i", ret); return ret; err: if (ca) bch2_dev_free(ca); - ret = -BCH_ERR_ENOMEM_dev_alloc; - goto out; + return -BCH_ERR_ENOMEM_dev_alloc; } static int __bch2_dev_attach_bdev(struct bch_dev *ca, struct bch_sb_handle *sb) @@ -1878,8 +1871,6 @@ struct bch_fs *bch2_fs_open(char * const *devices, unsigned nr_devices, if (!try_module_get(THIS_MODULE)) return ERR_PTR(-ENODEV); - pr_verbose_init(opts, ""); - if (!nr_devices) { ret = -EINVAL; goto err; @@ -1951,8 +1942,6 @@ out: kfree(sb); printbuf_exit(&errbuf); module_put(THIS_MODULE); - pr_verbose_init(opts, "ret %s (%i)", bch2_err_str(PTR_ERR_OR_ZERO(c)), - PTR_ERR_OR_ZERO(c)); return c; err_print: pr_err("bch_fs_open err opening %s: %s", |