diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-08-18 17:44:21 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-09-11 01:30:12 -0400 |
commit | 5dd575b9f9bdce082f48652891be53c6da9c653c (patch) | |
tree | a09549f2cc568d7e01e02f0e20f81105bd737601 | |
parent | 89cc1fa0910ce76bd75493e1a07fd9df7fe4b1a5 (diff) |
bcachefs: Fix bch2_mount error path
In the bch2_mount() error path, we were calling
deactivate_locked_super(), which calls ->kill_sb(), which in our case
was calling bch2_fs_free() without __bch2_fs_stop().
This changes bch2_mount() to just call bch2_fs_stop() directly.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/fs.c | 8 | ||||
-rw-r--r-- | fs/bcachefs/super.c | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index 8958957b648b..80dcda43e26b 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -1906,7 +1906,10 @@ out: return dget(sb->s_root); err_put_super: + sb->s_fs_info = NULL; + c->vfs_sb = NULL; deactivate_locked_super(sb); + bch2_fs_stop(c); return ERR_PTR(bch2_err_class(ret)); } @@ -1914,8 +1917,11 @@ static void bch2_kill_sb(struct super_block *sb) { struct bch_fs *c = sb->s_fs_info; + if (c) + c->vfs_sb = NULL; generic_shutdown_super(sb); - bch2_fs_free(c); + if (c) + bch2_fs_free(c); } static struct file_system_type bcache_fs_type = { diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 48670c8b56aa..e7dbc31be36d 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -581,6 +581,8 @@ void bch2_fs_free(struct bch_fs *c) { unsigned i; + BUG_ON(!test_bit(BCH_FS_STOPPING, &c->flags)); + mutex_lock(&bch_fs_list_lock); list_del(&c->list); mutex_unlock(&bch_fs_list_lock); |