From: Kent Overstreet <kent.overstreet@linux.dev>
To: linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Subject: [PATCH 3/7] bcachefs: Make sure c->vfs_sb is set before starting fs
Date: Fri, 7 Mar 2025 08:49:27 -0500 [thread overview]
Message-ID: <20250307134933.1033872-4-kent.overstreet@linux.dev> (raw)
In-Reply-To: <20250307134933.1033872-1-kent.overstreet@linux.dev>
This is necessary for the new blk_holder_ops, which want the vfs
super_block available for synchronization.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
---
fs/bcachefs/fs.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 2c011a465588..459ca8259fc0 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -2218,9 +2218,10 @@ static int bch2_fs_get_tree(struct fs_context *fc)
bch2_opts_apply(&c->opts, opts);
- ret = bch2_fs_start(c);
- if (ret)
- goto err_stop_fs;
+ /*
+ * need to initialise sb and set c->vfs_sb _before_ starting fs,
+ * for blk_holder_ops
+ */
sb = sget(fc->fs_type, NULL, bch2_set_super, fc->sb_flags|SB_NOSEC, c);
ret = PTR_ERR_OR_ZERO(sb);
@@ -2282,6 +2283,10 @@ static int bch2_fs_get_tree(struct fs_context *fc)
sb->s_shrink->seeks = 0;
+ ret = bch2_fs_start(c);
+ if (ret)
+ goto err_put_super;
+
vinode = bch2_vfs_inode_get(c, BCACHEFS_ROOT_SUBVOL_INUM);
ret = PTR_ERR_OR_ZERO(vinode);
bch_err_msg(c, ret, "mounting: error getting root inode");
--
2.47.2
next prev parent reply other threads:[~2025-03-07 13:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 13:49 [PATCH 0/7] blk_holder_ops, freeze/thaw Kent Overstreet
2025-03-07 13:49 ` [PATCH 1/7] fs: export invalidate_inodes() Kent Overstreet
2025-03-07 14:44 ` Jan Kara
2025-03-07 15:43 ` Kent Overstreet
2025-03-07 13:49 ` [PATCH 2/7] bcachefs: Stash a pointer to the filesystem for blk_holder_ops Kent Overstreet
2025-03-07 13:49 ` Kent Overstreet [this message]
2025-03-07 13:49 ` [PATCH 4/7] bcachefs: Implement blk_holder_ops Kent Overstreet
2025-03-07 13:49 ` [PATCH 5/7] bcachefs: Fix btree_node_scan io_ref handling Kent Overstreet
2025-03-07 13:49 ` [PATCH 6/7] bcachefs: bch2_dev_get_ioref() may now sleep Kent Overstreet
2025-03-07 13:49 ` [PATCH 7/7] bcachefs: Implement freeze/thaw Kent Overstreet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250307134933.1033872-4-kent.overstreet@linux.dev \
--to=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox