[PATCH RFC 0/3] mnt_idmapping: avoid pointer chase & inline low-level helpers

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

 



We currently always chase a pointer inode->i_sb->s_user_ns whenever we
need to map a uid/gid. Linus reported in [1] that this is noticable
during path lookup.

In the majority of cases we don't need to bother with that pointer chase
because the inode won't be located on a filesystem that's mounted in a
user namespace. The user namespace of the superblock cannot ever change
once it's mounted. So introduce and raise IOP_USERNS on all inodes and
check for that flag in i_user_ns() when we retrieve the user namespace.

Additionally, we now inline all low-level idmapping helpers.

[1]: https://lore.kernel.org/CAHk-=whJgRDtxTudTQ9HV8BFw5-bBsu+c8Ouwd_PrPqPB6_KEQ@xxxxxxxxxxxxxx

Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
---
Christian Brauner (3):
      inode: add fastpath for filesystem user namespace retrieval
      mnt_idmapping: add struct mnt_idmap to header
      mnt_idmapping: inline all low-level helpers

 fs/inode.c                     |   6 ++
 fs/mnt_idmapping.c             | 165 ----------------------------------------
 include/linux/fs.h             |   5 +-
 include/linux/mnt_idmapping.h  | 168 +++++++++++++++++++++++++++++++++++++++--
 include/linux/uidgid.h         |  23 +++++-
 include/linux/user_namespace.h |  23 +-----
 kernel/user_namespace.c        |   2 +
 7 files changed, 195 insertions(+), 197 deletions(-)
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250416-work-mnt_idmap-s_user_ns-eb57ee83e1d6





[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