From: Christian Brauner <brauner@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: viro@zeniv.linux.org.uk, jack@suse.cz, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs: open the block device after allocation the super_block
Date: Tue, 25 Jul 2023 14:35:12 +0200 [thread overview]
Message-ID: <20230725-tagebuch-gerede-a28f8fd8084a@brauner> (raw)
In-Reply-To: <20230724175145.201318-1-hch@lst.de>
On Mon, Jul 24, 2023 at 10:51:45AM -0700, Christoph Hellwig wrote:
> From: Jan Kara <jack@suse.cz>
>
> Currently get_tree_bdev and mount_bdev open the block device before
> commiting to allocating a super block. This means the block device
> is opened even for bind mounts and other reuses of the 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 mount code to first look whether the superblock for a
> particular device is already mounted and open the block device only if
> it is not.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> [hch: port to before the bdev_handle changes,
> duplicate the bdev read-only check from blkdev_get_by_path,
> extend the fsfree_mutex coverage to protect against freezes,
> fix an open bdev leak when the bdev is frozen,
> use the bdev local variable more,
> rename the s variable to sb to be more descriptive]
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>
> So I promised to get a series that builds on top of this ready, but
> I'm way to busy and this will take a while. Getting this reworked
> version of Jan's patch out for everyone to use it as a based given
> that Christian is back from vacation, and I think Jan should be about
> back now as well.
I'm in the middle of reviewing this. You're probably aware, but both
btrfs and nilfs at least still open the devices first since they
open-code their bdev and sb handling.
next prev parent reply other threads:[~2023-07-25 12:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-24 17:51 [PATCH] fs: open the block device after allocation the super_block Christoph Hellwig
2023-07-25 12:35 ` Christian Brauner [this message]
2023-07-25 16:32 ` Christian Brauner
2023-07-26 12:51 ` Christoph Hellwig
2023-07-26 12:57 ` Christian Brauner
2023-07-25 15:53 ` Christian Brauner
2023-08-15 14:43 ` Christian Brauner
2023-08-16 7:29 ` Christian Brauner
2023-08-16 21:39 ` Jan Kara
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=20230725-tagebuch-gerede-a28f8fd8084a@brauner \
--to=brauner@kernel.org \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).