lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240308-vfs-super-ebcd3585c240@brauner>
Date: Fri,  8 Mar 2024 11:17:38 +0100
From: Christian Brauner <brauner@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Christian Brauner <brauner@...nel.org>,
	linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [GIT PULL] vfs super

Hey Linus,

/* Summary */
Last cycle we changed opening of block devices in [1]. Now opening a
block device would return a bdev_handle. This allowed us to implement
support for restricting and forbidding writes to mounted block devices.
It was accompanied by converting and adding helpers to operate on
bdev_handles instead of plain block devices.

That was already a good step forward but ultimately it isn't necessary
to have special purpose helpers for opening block devices internally
that return a bdev_handle.

Fundamentally, opening a block device internally should just be
equivalent to opening files. So with this pull request all internal
opens of block devices return files just as a userspace open would.
Instead of introducing a separate indirection into bdev_open_by_*() via
struct bdev_handle bdev_file_open_by_*() is made to just return
a struct file. Opening and closing a block device just becomes
equivalent to opening and closing a file.

This all works well because internally we already have a pseudo fs for
block devices and so opening block devices is simple. There's a few
places where we needed to be careful such as during boot when the kernel
is supposed to mount the rootfs directly without init doing it. Here we
need to take care to ensure that we flush out any asynchronous file
close. That's what we already do for opening, unpacking, and closing the
initramfs. So nothing new here.

The equivalence of opening and closing block devices to regular files is
a win in and of itself. But it also has various other advantages. We can
remove struct bdev_handle completely. Various low-level helpers are now
private to the block layer. Other helpers were simply removable
completely.

A follow-up series that is already reviewed build on this and makes it
possible to remove bdev->bd_inode and allows various clean ups of the
buffer head code as well. All places where we stashed a bdev_handle now
just stash a file and use simple accessors to get to the actual block
device which was already the case for bdev_handle.

Link: 3f6984e7301f ("Merge tag 'vfs-6.8.super' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs") [1]

/* Testing */
clang: Debian clang version 16.0.6 (19)
gcc: (Debian 13.2.0-7) 13.2.0

All patches are based on v6.8-rc1 and have been sitting in linux-next.
No build failures or warnings were observed.

This series has been in -next for a very long time and it held up in
xfstests and in blktests so far.

/* Conflicts */

Merge conflicts with other trees
================================

[1] linux-next: manual merge of the block tree with the vfs-brauner tree
    https://lore.kernel.org/linux-next/20240206124852.6183d0f7@canb.auug.org.au

    Full transparency: I had intended to coordinate this merge with Jens
    to minimize the conflict but I just remembered the merge conflict
    right now as I went through all the conflicts I had written down.

[2] linux-next: manual merge of the vfs-brauner tree with the bcachefs tree
    https://lore.kernel.org/linux-next/20240213100455.07e181c8@canb.auug.org.au

[3] linux-next: manual merge of the vfs-brauner tree with the bcachefs tree
    https://lore.kernel.org/linux-next/20240215100517.027fd255@canb.auug.org.au

[4] linux-next: manual merge of the vfs-brauner tree with the bcachefs tree
    https://lore.kernel.org/linux-next/20240226111257.2784c310@canb.auug.org.au

[5] linux-next: manual merge of the vfs-brauner tree with the xfs tree
    https://lore.kernel.org/linux-next/20240227102827.313113cd@canb.auug.org.au

[6] linux-next: manual merge of the vfs-brauner tree with the f2fs tree
    https://lore.kernel.org/linux-next/20240229104140.2927da29@canb.auug.org.au

Merge conflicts with mainline
=============================

[1] There's a merge conflict with bcachefs that can be resolved as follows:

    diff --cc fs/bcachefs/super-io.c
    index 36988add581f,ce8cf2d91f84..000000000000
    --- a/fs/bcachefs/super-io.c
    +++ b/fs/bcachefs/super-io.c
    @@@ -715,11 -715,11 +715,11 @@@ retry
                            opt_set(*opts, nochanges, true);
            }
    
    -       if (IS_ERR(sb->bdev_handle)) {
    -               ret = PTR_ERR(sb->bdev_handle);
    +       if (IS_ERR(sb->s_bdev_file)) {
    +               ret = PTR_ERR(sb->s_bdev_file);
     -              goto out;
     +              goto err;
            }
    -       sb->bdev = sb->bdev_handle->bdev;
    +       sb->bdev = file_bdev(sb->s_bdev_file);
    
            ret = bch2_sb_realloc(sb, 0);
            if (ret) {

The following changes since commit 6613476e225e090cc9aad49be7fa504e290dd33d:

  Linux 6.8-rc1 (2024-01-21 14:11:32 -0800)

are available in the Git repository at:

  git@...olite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.9.super

for you to fetch changes up to 40ebc18b991bdb867bc693a4ac1b5d7db44838f3:

  Merge series 'Open block devices as files' of https://lore.kernel.org/r/20240123-vfs-bdev-file-v2-0-adbd023e19cc@kernel.org (2024-02-25 12:05:28 +0100)

Please consider pulling these changes from the signed vfs-6.9.super tag.

Thanks!
Christian

----------------------------------------------------------------
vfs-6.9.super

----------------------------------------------------------------
Christian Brauner (36):
      init: flush async file closing
      file: prepare for new helper
      file: add alloc_file_pseudo_noaccount()
      bdev: open block device as files
      block/ioctl: port blkdev_bszset() to file
      block/genhd: port disk_scan_partitions() to file
      md: port block device access to file
      swap: port block device usage to file
      power: port block device access to file
      xfs: port block device access to files
      drbd: port block device access to file
      pktcdvd: port block device access to file
      rnbd: port block device access to file
      xen: port block device access to file
      zram: port block device access to file
      bcache: port block device access to files
      block2mtd: port device access to files
      nvme: port block device access to file
      s390: port block device access to file
      target: port block device access to file
      bcachefs: port block device access to file
      btrfs: port device access to file
      erofs: port device access to file
      ext4: port block device access to file
      f2fs: port block device access to files
      jfs: port block device access to file
      nfs: port block device access to files
      ocfs2: port block device access to file
      reiserfs: port block device access to file
      bdev: remove bdev_open_by_path()
      bdev: make bdev_{release, open_by_dev}() private to block layer
      bdev: make struct bdev_handle private to the block layer
      bdev: remove bdev pointer from struct bdev_handle
      block: don't rely on BLK_OPEN_RESTRICT_WRITES when yielding write access
      block: remove bdev_handle completely
      Merge series 'Open block devices as files' of https://lore.kernel.org/r/20240123-vfs-bdev-file-v2-0-adbd023e19cc@kernel.org

 block/bdev.c                        | 252 ++++++++++++++++++++++--------------
 block/blk.h                         |   4 +
 block/fops.c                        |  46 +++----
 block/genhd.c                       |  12 +-
 block/ioctl.c                       |   9 +-
 drivers/block/drbd/drbd_int.h       |   4 +-
 drivers/block/drbd/drbd_nl.c        |  58 ++++-----
 drivers/block/pktcdvd.c             |  68 +++++-----
 drivers/block/rnbd/rnbd-srv.c       |  28 ++--
 drivers/block/rnbd/rnbd-srv.h       |   2 +-
 drivers/block/xen-blkback/blkback.c |   4 +-
 drivers/block/xen-blkback/common.h  |   4 +-
 drivers/block/xen-blkback/xenbus.c  |  37 +++---
 drivers/block/zram/zram_drv.c       |  26 ++--
 drivers/block/zram/zram_drv.h       |   2 +-
 drivers/md/bcache/bcache.h          |   4 +-
 drivers/md/bcache/super.c           |  74 +++++------
 drivers/md/dm.c                     |  23 ++--
 drivers/md/md.c                     |  12 +-
 drivers/md/md.h                     |   2 +-
 drivers/mtd/devices/block2mtd.c     |  46 +++----
 drivers/nvme/target/io-cmd-bdev.c   |  16 +--
 drivers/nvme/target/nvmet.h         |   2 +-
 drivers/s390/block/dasd.c           |  10 +-
 drivers/s390/block/dasd_genhd.c     |  36 +++---
 drivers/s390/block/dasd_int.h       |   2 +-
 drivers/s390/block/dasd_ioctl.c     |   2 +-
 drivers/target/target_core_iblock.c |  18 +--
 drivers/target/target_core_iblock.h |   2 +-
 drivers/target/target_core_pscsi.c  |  22 ++--
 drivers/target/target_core_pscsi.h  |   2 +-
 fs/bcachefs/super-io.c              |  20 +--
 fs/bcachefs/super_types.h           |   2 +-
 fs/btrfs/dev-replace.c              |  14 +-
 fs/btrfs/ioctl.c                    |  16 +--
 fs/btrfs/volumes.c                  |  92 ++++++-------
 fs/btrfs/volumes.h                  |   4 +-
 fs/cramfs/inode.c                   |   2 +-
 fs/erofs/data.c                     |   6 +-
 fs/erofs/internal.h                 |   2 +-
 fs/erofs/super.c                    |  16 +--
 fs/ext4/ext4.h                      |   2 +-
 fs/ext4/fsmap.c                     |   8 +-
 fs/ext4/super.c                     |  52 ++++----
 fs/f2fs/f2fs.h                      |   2 +-
 fs/f2fs/super.c                     |  12 +-
 fs/file_table.c                     |  83 +++++++++---
 fs/jfs/jfs_logmgr.c                 |  26 ++--
 fs/jfs/jfs_logmgr.h                 |   2 +-
 fs/jfs/jfs_mount.c                  |   2 +-
 fs/nfs/blocklayout/blocklayout.h    |   2 +-
 fs/nfs/blocklayout/dev.c            |  68 +++++-----
 fs/ocfs2/cluster/heartbeat.c        |  32 ++---
 fs/reiserfs/journal.c               |  38 +++---
 fs/reiserfs/procfs.c                |   2 +-
 fs/reiserfs/reiserfs.h              |   8 +-
 fs/romfs/super.c                    |   2 +-
 fs/super.c                          |  18 +--
 fs/xfs/xfs_buf.c                    |  10 +-
 fs/xfs/xfs_buf.h                    |   4 +-
 fs/xfs/xfs_super.c                  |  44 +++----
 include/linux/blkdev.h              |  13 +-
 include/linux/device-mapper.h       |   2 +-
 include/linux/file.h                |   2 +
 include/linux/fs.h                  |   4 +-
 include/linux/pktcdvd.h             |   4 +-
 include/linux/swap.h                |   2 +-
 init/do_mounts.c                    |   3 +
 init/do_mounts.h                    |   9 ++
 init/initramfs.c                    |   6 +-
 kernel/power/swap.c                 |  28 ++--
 mm/swapfile.c                       |  22 ++--
 72 files changed, 812 insertions(+), 703 deletions(-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ