Re: [PATCH v4 0/6] querying mount attributes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 25/10/23 22:01, Miklos Szeredi wrote:
Implement mount querying syscalls agreed on at LSF/MM 2023.

Features:

  - statx-like want/got mask
  - allows returning ascii strings (fs type, root, mount point)
  - returned buffer is relocatable (no pointers)

Still missing:
  - man pages
  - kselftest

Please find the test utility at the end of this mail.

   Usage: statmnt [-l|-r] [-u] (mnt_id|path)

Git tree:

   git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git#statmount-v4


Changes v3..v4:

  - incorporate patch moving list of mounts to an rbtree
  - wire up syscalls for all archs
  - add LISTMOUNT_RECURSIVE (depth first iteration of mount tree)
  - add LSMT_ROOT (list root instead of a specific mount ID)
  - list_for_each_entry_del() moved to a separate patchset

Changes v1..v3:

  - rename statmnt(2) -> statmount(2)
  - rename listmnt(2) -> listmount(2)
  - make ABI 32bit compatible by passing 64bit args in a struct (tested on
    i386 and x32)
  - only accept new 64bit mount IDs
  - fix compile on !CONFIG_PROC_FS
  - call security_sb_statfs() in both syscalls
  - make lookup_mnt_in_ns() static
  - add LISTMOUNT_UNREACHABLE flag to listmnt() to explicitly ask for
    listing unreachable mounts
  - remove .sb_opts
  - remove subtype from .fs_type
  - return the number of bytes used (including strings) in .size
  - rename .mountpoint -> .mnt_point
  - point strings by an offset against char[] VLA at the end of the struct.
    E.g. printf("fs_type: %s\n", st->str + st->fs_type);
  - don't save string lengths
  - extend spare space in struct statmnt (complete size is now 512 bytes)


Miklos Szeredi (6):
   add unique mount ID
   mounts: keep list of mounts in an rbtree
   namespace: extract show_path() helper
   add statmount(2) syscall
   add listmount(2) syscall
   wire up syscalls for statmount/listmount

  arch/alpha/kernel/syscalls/syscall.tbl      |   3 +
  arch/arm/tools/syscall.tbl                  |   3 +
  arch/arm64/include/asm/unistd32.h           |   4 +
  arch/ia64/kernel/syscalls/syscall.tbl       |   3 +
  arch/m68k/kernel/syscalls/syscall.tbl       |   3 +
  arch/microblaze/kernel/syscalls/syscall.tbl |   3 +
  arch/mips/kernel/syscalls/syscall_n32.tbl   |   3 +
  arch/mips/kernel/syscalls/syscall_n64.tbl   |   3 +
  arch/mips/kernel/syscalls/syscall_o32.tbl   |   3 +
  arch/parisc/kernel/syscalls/syscall.tbl     |   3 +
  arch/powerpc/kernel/syscalls/syscall.tbl    |   3 +
  arch/s390/kernel/syscalls/syscall.tbl       |   3 +
  arch/sh/kernel/syscalls/syscall.tbl         |   3 +
  arch/sparc/kernel/syscalls/syscall.tbl      |   3 +
  arch/x86/entry/syscalls/syscall_32.tbl      |   3 +
  arch/x86/entry/syscalls/syscall_64.tbl      |   2 +
  arch/xtensa/kernel/syscalls/syscall.tbl     |   3 +
  fs/internal.h                               |   2 +
  fs/mount.h                                  |  27 +-
  fs/namespace.c                              | 573 ++++++++++++++++----
  fs/pnode.c                                  |   2 +-
  fs/proc_namespace.c                         |  13 +-
  fs/stat.c                                   |   9 +-
  include/linux/mount.h                       |   5 +-
  include/linux/syscalls.h                    |   8 +
  include/uapi/asm-generic/unistd.h           |   8 +-
  include/uapi/linux/mount.h                  |  65 +++
  include/uapi/linux/stat.h                   |   1 +
  28 files changed, 635 insertions(+), 129 deletions(-)

Looks ok to me,covers the primary cases I needed when I worked

on using fsinfo() in systemd.


Karel, is there anything missing you would need for adding

libmount support?


Reviewed-by: Ian Kent <raven@xxxxxxxxxx>







[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux