On Fri, Aug 11, 2023 at 03:11:31PM +0200, David Sterba wrote: > On Fri, Aug 11, 2023 at 02:44:50PM +0200, Christian Brauner wrote: > > On Fri, Aug 11, 2023 at 12:08:16PM +0200, Christoph Hellwig wrote: > > > Currently btrfs_mount_root opens the block devices before committing to > > > allocating a super block. That creates problems for restricting the > > > number of writers to a device, and also leads to a unusual and not very > > > helpful holder (the fs_type). > > > > > > Reorganize the code to first check whether the superblock for a > > > particular fsid does already exist and open the block devices only if it > > > doesn't, mirroring the recent changes to the VFS mount helpers. To do > > > this the increment of the in_use counter moves out of btrfs_open_devices > > > and into the only caller in btrfs_mount_root so that it happens before > > > dropping uuid_mutex around the call to sget. > > > > > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > > > --- > > > > Looks good to me, > > Acked-by: Christian Brauner <brauner@xxxxxxxxxx> > > > > And ofc, would be great to get btrfs reviews. > > I'll take a look but there are some performance regressions to deal with > and pre-merge window freeze so it won't be soon. I'd rather take the btrfs patches via my tree and get them tested for a longer time. This patch in particular changes locking, mount, device management, that's beyond what I'd consider safe to get merged outside of btrfs.