linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] btrfs: add remove_bdev() callback
@ 2025-07-01  5:32 Qu Wenruo
  2025-07-01  5:32 ` [PATCH v2 1/6] fs: enhance and rename shutdown() callback to remove_bdev() Qu Wenruo
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: Qu Wenruo @ 2025-07-01  5:32 UTC (permalink / raw)
  To: linux-btrfs, linux-fsdevel; +Cc: viro, brauner, jack

[CHANGELOG]
v2:
- Enhance and rename shutdown() callback
  Rename it to remove_bdev() and add a @bdev parameter.
  For the existing call backs in filesystems, keep their callback
  function names, now something like ".remove_bdev = ext4_shutdown,"
  will be a quick indicator of the behavior.

- Remove the @surprise parameter for the remove_bdev() parameter.
  The fs_bdev_mark_dead() is already trying to sync the fs if it's not
  a surprise removal.
  So there isn't much a filesystem can do with the @surprise parameter.

- Fix btrfs error handling when the devices are not opened
  There are several cases that the fs_devices is not opened, including:
  * sget_fc() failure
  * an existing super block is returned
  * a new super block is returned but btrfS_open_fs_devices() failed

  Handle the error properly so that fs_devices is not freed twice.

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 at least 2 test failures (g/388, g/508).

  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.


Qu Wenruo (6):
  fs: enhance and rename shutdown() callback to remove_bdev()
  btrfs: introduce a new fs state, EMERGENCY_SHUTDOWN
  btrfs: reject file operations if in shutdown state
  btrfs: reject delalloc ranges if in shutdown state
  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           | 45 ++++++++++++++++++++++++++++++++++++++
 fs/btrfs/volumes.c         |  2 ++
 fs/btrfs/volumes.h         |  5 +++++
 fs/exfat/super.c           |  4 ++--
 fs/ext4/super.c            |  4 ++--
 fs/f2fs/super.c            |  4 ++--
 fs/ntfs3/super.c           |  4 ++--
 fs/super.c                 |  4 ++--
 fs/xfs/xfs_super.c         |  5 +++--
 include/linux/fs.h         |  7 +++++-
 include/uapi/linux/btrfs.h |  9 ++++++++
 17 files changed, 192 insertions(+), 15 deletions(-)

-- 
2.50.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2025-07-02  9:38 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-01  5:32 [PATCH v2 0/6] btrfs: add remove_bdev() callback Qu Wenruo
2025-07-01  5:32 ` [PATCH v2 1/6] fs: enhance and rename shutdown() callback to remove_bdev() Qu Wenruo
2025-07-01  5:54   ` Darrick J. Wong
2025-07-01  6:14   ` Christoph Hellwig
2025-07-01  6:35     ` Qu Wenruo
2025-07-01  6:40       ` Christoph Hellwig
2025-07-01  8:41       ` Christian Brauner
2025-07-01  8:46         ` Qu Wenruo
2025-07-01  7:52   ` Jan Kara
2025-07-01  5:32 ` [PATCH v2 2/6] btrfs: introduce a new fs state, EMERGENCY_SHUTDOWN Qu Wenruo
2025-07-01  5:32 ` [PATCH v2 3/6] btrfs: reject file operations if in shutdown state Qu Wenruo
2025-07-01  5:32 ` [PATCH v2 4/6] btrfs: reject delalloc ranges " Qu Wenruo
2025-07-01  5:32 ` [PATCH v2 5/6] btrfs: implement shutdown ioctl Qu Wenruo
2025-07-02  9:38   ` kernel test robot
2025-07-01  5:32 ` [PATCH v2 6/6] btrfs: implement remove_bdev super operation callback Qu Wenruo
2025-07-01  8:21   ` Anand Jain
2025-07-01  8:30     ` Qu Wenruo

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).