Skip to content

Commit

Permalink
bcachefs: Fix error path in bch2_mount()
Browse files Browse the repository at this point in the history
This fixes a bug discovered by generic/388 where sb->s_fs_info was NULL
while the superblock was still active - the error path was entirely
fubar, and was trying to do something unclear and unecessary.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
  • Loading branch information
Kent Overstreet committed Nov 15, 2023
1 parent b783fc4 commit 178c487
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions fs/bcachefs/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1922,22 +1922,16 @@ static struct dentry *bch2_mount(struct file_system_type *fs_type,
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));
}

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);
if (c)
bch2_fs_free(c);
bch2_fs_free(c);
}

static struct file_system_type bcache_fs_type = {
Expand Down

0 comments on commit 178c487

Please sign in to comment.