Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH RESEND] btrfs: use the super_block as holder when mounting file systems
@ 2023-09-21 12:19 Jan Kara
  2023-09-21 12:50 ` Christian Brauner
  2023-09-25 15:54 ` David Sterba
  0 siblings, 2 replies; 8+ messages in thread
From: Jan Kara @ 2023-09-21 12:19 UTC (permalink / raw)
  To: David Sterba
  Cc: linux-btrfs, Christoph Hellwig, Christian Brauner, Josef Bacik,
	Christoph Hellwig, Jan Kara

From: Christoph Hellwig <hch@lst.de>

The file system type is not a very useful holder as it doesn't allow us
to go back to the actual file system instance.  Pass the super_block
instead which is useful when passed back to the file system driver.

This matches what is done for all other block device based file systems and it
also fixes an issue that block device freezing (as used e.g. by LVM when
performing device snapshots) starts working for btrfs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Message-Id: <20230811100828.1897174-7-hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/btrfs/super.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Hello,

I'm resending this btrfs fix. Can you please merge it David? It's the only bit
remaining from the original Christoph's block device opening patches and is
blocking me in pushing out the opening of block devices using bdev_handle.
Thanks!

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 4577cd64da2e..94ca2236e57f 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -70,8 +70,6 @@ static const struct super_operations btrfs_super_ops;
  * requested by subvol=/path. That way the callchain is straightforward and we
  * don't have to play tricks with the mount options and recursive calls to
  * btrfs_mount.
- *
- * The new btrfs_root_fs_type also servers as a tag for the bdev_holder.
  */
 static struct file_system_type btrfs_fs_type;
 static struct file_system_type btrfs_root_fs_type;
@@ -1462,8 +1460,7 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
 		struct btrfs_fs_devices *fs_devices = fs_info->fs_devices;
 
 		mutex_lock(&uuid_mutex);
-		error = btrfs_open_devices(fs_devices, sb_open_mode(flags),
-					   fs_type);
+		error = btrfs_open_devices(fs_devices, sb_open_mode(flags), s);
 		mutex_unlock(&uuid_mutex);
 		if (error)
 			goto error_deactivate;
@@ -1477,7 +1474,7 @@ static struct dentry *btrfs_mount_root(struct file_system_type *fs_type,
 			 fs_devices->latest_dev->bdev);
 		shrinker_debugfs_rename(&s->s_shrink, "sb-%s:%s", fs_type->name,
 					s->s_id);
-		btrfs_sb(s)->bdev_holder = fs_type;
+		btrfs_sb(s)->bdev_holder = s;
 		error = btrfs_fill_super(s, fs_devices, data);
 	}
 	if (!error)
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-26  9:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-21 12:19 [PATCH RESEND] btrfs: use the super_block as holder when mounting file systems Jan Kara
2023-09-21 12:50 ` Christian Brauner
2023-09-21 13:07   ` Jan Kara
2023-09-21 13:33     ` Christian Brauner
2023-09-25 16:13   ` David Sterba
2023-09-26  9:59     ` Christian Brauner
2023-09-25 15:54 ` David Sterba
2023-09-26  9:45   ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox