Skip to content

Commit 9c61856

Browse files
author
Kent Overstreet
committed
bcachefs: Call bch2_fs_start before getting vfs superblock
This reverts 1fdbe0b bcachefs: Make sure c->vfs_sb is set before starting fs switched up bch2_fs_get_tree() so that we got a superblock before calling bch2_fs_start, so that c->vfs_sb would always be initialized while the filesystem was active. This turned out not to be necessary, because blk_holder_ops were implemented using our own locking, not vfs locking. And this had the side effect of creating a super_block and doing our full recovery (including potentially fsck) before setting SB_BORN, which causes things like sync calls to hang until our recovery is finished. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent aed4ccb commit 9c61856

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

fs/bcachefs/fs.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,10 +2502,9 @@ static int bch2_fs_get_tree(struct fs_context *fc)
25022502

25032503
bch2_opts_apply(&c->opts, opts);
25042504

2505-
/*
2506-
* need to initialise sb and set c->vfs_sb _before_ starting fs,
2507-
* for blk_holder_ops
2508-
*/
2505+
ret = bch2_fs_start(c);
2506+
if (ret)
2507+
goto err_stop_fs;
25092508

25102509
sb = sget(fc->fs_type, NULL, bch2_set_super, fc->sb_flags|SB_NOSEC, c);
25112510
ret = PTR_ERR_OR_ZERO(sb);
@@ -2567,10 +2566,6 @@ static int bch2_fs_get_tree(struct fs_context *fc)
25672566

25682567
sb->s_shrink->seeks = 0;
25692568

2570-
ret = bch2_fs_start(c);
2571-
if (ret)
2572-
goto err_put_super;
2573-
25742569
#ifdef CONFIG_UNICODE
25752570
sb->s_encoding = c->cf_encoding;
25762571
#endif

0 commit comments

Comments
 (0)