Re: [PATCH 05/17] btrfs: open block devices after superblock creation
From: Christian Brauner <brauner@kernel.org>
Date: 2023-08-11 12:44:59
Also in:
linux-btrfs, linux-fsdevel, linux-s390
From: Christian Brauner <brauner@kernel.org>
Date: 2023-08-11 12:44:59
Also in:
linux-btrfs, linux-fsdevel, linux-s390
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@lst.de> ---
Looks good to me, Acked-by: Christian Brauner <brauner@kernel.org> And ofc, would be great to get btrfs reviews.