From: Qu Wenruo <wqu@suse.com>
To: Christian Brauner <brauner@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>, Jan Kara <jack@suse.cz>,
linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
viro@zeniv.linux.org.uk
Subject: Re: [PATCH RFC 5/6] fs: introduce a shutdown_bdev super block operation
Date: Tue, 24 Jun 2025 18:36:01 +0930 [thread overview]
Message-ID: <8db82a80-242f-41ff-84b8-601d6dcd9b9d@suse.com> (raw)
In-Reply-To: <20250624-geerntet-haare-2ce4cc42b026@brauner>
在 2025/6/24 18:21, Christian Brauner 写道:
> On Tue, Jun 24, 2025 at 06:57:08AM +0930, Qu Wenruo wrote:
>>
>>
>> 在 2025/6/23 23:27, Christoph Hellwig 写道:
>>> On Mon, Jun 23, 2025 at 12:56:28PM +0200, Christian Brauner wrote:
>>>> void (*shutdown)(struct super_block *sb);
>>>> + void (*drop_bdev)(struct super_block *sb, struct block_device *bdev /* , unsigned int flags/reason maybe too ? */);
>>>> };
>>>>
>>>> You might want to drop a block device independent of whether the device
>>>> was somehow lost. So I find that a bit more flexible.
>>>
>>> Drop is weird word for what is happening here, and if it wasn't for the
>>> context in this thread I'd expect it to be about refcounting in Linux.
>>>
>>> When the VFS/libfs does an upcall into the file system to notify it
>>> that a device is gone that's pretty much a device loss. I'm not married
>>> to the exact name, but drop seems like a pretty bad choice.
>>
>> What about a more common used term, mark_dead()?
>>
>> It's already used in blk_holder_ops, and I'd say it's more straighforward to
>> me, compared to shutdown()/goingdown().
>
> But it's not about the superblock going down necessarily. It's about the
> device going away for whatever reason:
>
> void (*yank_bdev)(struct super_block *sb, struct block_device *bdev /* , unsigned int flags/reason maybe too ? */);
> void (*pull_bdev)(struct super_block *sb, struct block_device *bdev /* , unsigned int flags/reason maybe too ? */);
> void (*unplug_bdev)(struct super_block *sb, struct block_device *bdev /* , unsigned int flags/reason maybe too ? */);
> void (*remove_bdev)(struct super_block *sb, struct block_device *bdev /* , unsigned int flags/reason maybe too ? */);
All sound good to me, although the last one sounds better.
>
> On a single device superblock unplugging that device would obviously
> cause an actual shutdown. On multi-device superblocks it doesn't always.
>
> (That brings me to another thought. Is there a use-case for knowing in
> advance whether removing a device would shut down the superblock?
Maybe another interface like can_remove_bdev()?
It's not hard for btrfs to provide it, we already have a check function
btrfs_check_rw_degradable() to do that.
Although I'd say, that will be something way down the road.
We even don't have a proper way to let end user configure the device
loss behavior.
E.g. some end users may prefer a full shutdown to be extra cautious,
other than continue degraded.
Thanks,
Qu
> Because then the ability to probe whether a device can be safely
> removed or an option to only remove the device if it can be removed
> without killing the superblock would be a natural extension.)
next prev parent reply other threads:[~2025-06-24 9:06 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 5:47 [PATCH RFC 0/6] btrfs: go fs_holder_ops and add shutdown_bdev() callback Qu Wenruo
2025-06-20 5:47 ` [PATCH RFC 1/6] btrfs: introduce a new fs state, EMERGENCY_SHUTDOWN Qu Wenruo
2025-06-20 5:47 ` [PATCH RFC 2/6] btrfs: reject file operations if in shutdown state Qu Wenruo
2025-06-20 5:47 ` [PATCH RFC 3/6] btrfs: reject delalloc ranges if the fs is shutdown Qu Wenruo
2025-06-20 5:47 ` [PATCH RFC 4/6] btrfs: implement shutdown ioctl Qu Wenruo
2025-06-20 5:47 ` [PATCH RFC 5/6] fs: introduce a shutdown_bdev super block operation Qu Wenruo
2025-06-20 15:36 ` Jan Kara
2025-06-20 22:10 ` Qu Wenruo
2025-06-23 5:15 ` Christoph Hellwig
2025-06-23 5:34 ` Qu Wenruo
2025-06-23 10:57 ` Jan Kara
2025-06-23 10:56 ` Christian Brauner
2025-06-23 13:57 ` Christoph Hellwig
2025-06-23 21:27 ` Qu Wenruo
2025-06-24 8:51 ` Christian Brauner
2025-06-24 9:06 ` Qu Wenruo [this message]
2025-06-24 9:13 ` Christian Brauner
2025-06-24 9:51 ` Qu Wenruo
2025-06-24 10:15 ` Christian Brauner
2025-06-24 21:06 ` Qu Wenruo
2025-06-24 12:34 ` Christoph Hellwig
2025-06-24 12:33 ` Christoph Hellwig
2025-06-24 12:30 ` Christoph Hellwig
2025-06-20 5:47 ` [PATCH RFC 6/6] btrfs: implement shutdown_bdev super operation callback Qu Wenruo
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=8db82a80-242f-41ff-84b8-601d6dcd9b9d@suse.com \
--to=wqu@suse.com \
--cc=brauner@kernel.org \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--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).