From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz
Subject: [PATCH 0/6] btrfs: add remove_bdev() callback
Date: Thu, 26 Jun 2025 09:23:41 +0930 [thread overview]
Message-ID: <cover.1750895337.git.wqu@suse.com> (raw)
[CHANGELOG]
RFC->v1:
- Add a new remove_bdev() callback
Thanks all the feedback from Christian, Christoph and Jan on this new
name.
- Add a @surprise parameter to the remove_bdev() callback
To keep it the same as the bdev_mark_dead().
- Hide the shutdown ioctl and remove_bdev callback behind experimental
With the shutdown ioctl, there are 3 test failures (g/050, g/388,
g/508).
G/050 may require a test case update.
G/388 is related to the error handling with COW fixup.
G/508 looks like something related to log replay.
And the remove_bdev() doesn't have any btrfs specific test case yet to
check the auto-degraded behavior, nor the auto-degraded behavior is
fully discussed.
So hide both of them behind experimental features.
- Do not use btrfs_handle_fs_error() to avoid freeze/thaw behavior change
btrfs_handle_fs_error() will flips the fs read-only, which will
affect freeze/thaw behavior.
And no other fs set the fs read-only when shutting down, so follow the
other fs to have a more consistent behavior.
The series is based on the fs_holder_ops patchset here:
https://lore.kernel.org/linux-btrfs/cover.1750724841.git.wqu@suse.com/
The full series including the btrfs' support of fs_holder_ops can be
found here:
https://github.com/adam900710/linux/tree/shutdown
Patch 1 is introducing the new remove_bdev() super operation callback,
with not only the extra @bdev parameter, but also a @surprise flag to
follow bdev_mark_dead().
Patch 2~5 implement the shutdown ioctl so that btrfs can benefit from
the existing shutdown test group.
Although it's still only enabled for experimental builds, as there are
still some minor failures needs to be addressed
Patch 6 implements the remove_bdev() callback, so that btrfs can either
shutdown the fs or continue degraded.
It's still an experimental feature, as we still need more disccussion
on the user expectation and possible extra user configurable behaviors.
Qu Wenruo (6):
fs: add a new remove_bdev() super operations callback
btrfs: introduce a new fs state, EMERGENCY_SHUTDOWN
btrfs: reject file operations if in shutdown state
btrfs: reject delalloc ranges if the fs is shutdown
btrfs: implement shutdown ioctl
btrfs: implement remove_bdev super operation callback
fs/btrfs/file.c | 25 ++++++++++++++++-
fs/btrfs/fs.h | 28 +++++++++++++++++++
fs/btrfs/inode.c | 14 +++++++++-
fs/btrfs/ioctl.c | 43 +++++++++++++++++++++++++++++
fs/btrfs/messages.c | 1 +
fs/btrfs/reflink.c | 3 +++
fs/btrfs/super.c | 55 ++++++++++++++++++++++++++++++++++++++
fs/btrfs/volumes.c | 2 ++
fs/btrfs/volumes.h | 5 ++++
fs/super.c | 4 ++-
include/linux/fs.h | 18 +++++++++++++
include/uapi/linux/btrfs.h | 9 +++++++
12 files changed, 204 insertions(+), 3 deletions(-)
--
2.49.0
next reply other threads:[~2025-06-25 23:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 23:53 Qu Wenruo [this message]
2025-06-25 23:53 ` [PATCH 1/6] fs: add a new remove_bdev() super operations callback Qu Wenruo
2025-06-26 8:38 ` Christian Brauner
2025-06-26 8:44 ` Qu Wenruo
2025-06-26 9:10 ` Christian Brauner
2025-06-26 9:18 ` Qu Wenruo
2025-06-26 9:29 ` Christian Brauner
2025-06-26 10:14 ` Christoph Hellwig
2025-06-26 10:36 ` Qu Wenruo
2025-06-26 11:02 ` Christoph Hellwig
2025-07-01 11:35 ` Christian Brauner
2025-06-25 23:53 ` [PATCH 2/6] btrfs: introduce a new fs state, EMERGENCY_SHUTDOWN Qu Wenruo
2025-06-25 23:53 ` [PATCH 3/6] btrfs: reject file operations if in shutdown state Qu Wenruo
2025-06-25 23:53 ` [PATCH 4/6] btrfs: reject delalloc ranges if the fs is shutdown Qu Wenruo
2025-06-25 23:53 ` [PATCH 5/6] btrfs: implement shutdown ioctl Qu Wenruo
2025-06-25 23:53 ` [PATCH 6/6] btrfs: implement remove_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=cover.1750895337.git.wqu@suse.com \
--to=wqu@suse.com \
--cc=brauner@kernel.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).