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>
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));
}
{
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 = {
{
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);