Skip to content

tweak fs mapping helpers

Christian Brauner linux-fsdevel linux-xfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 6 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4fs: document mapping helpersinclude/linux/fs.h+48 -03 replies
2/4fs: document and rename fsid helpersfs/ext4/ialloc.c fs/inode.c fs/namei.c +3 more+40 -161 reply
3/4fs: introduce fsuidgid_has_mapping() helperfs/namei.c include/linux/fs.h+23 -81 reply
4/4fs: introduce two inode i_{u,g}id initialization helpersfs/ext4/ialloc.c fs/inode.c fs/xfs/xfs_inode.c +1 more+32 -41 reply

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchVivek GoyalChristoph Hellwig
1/4R-b
2/4Inspired-by R-b
3/4Inspired-by R-b R-b
4/4Inspired-by R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] tweak fs mapping helpers

Hey,

/* v2 */
Add some kernel docs to helpers as suggested by Christoph. Switch to Al's naming proposal for these helpers. (Added Acks.)

This little series tries to improve naming and developer friendliness of fs idmapping helpers triggered by a request/comment from Vivek. Let's remove the two open-coded checks for whether there's a mapping for fsuid/fsgid in the s_user_ns of the underlying filesystem. Instead move them into a tiny helper, getting rid of redundancy and making sure that if we ever change something it's changed in all places. Also add two helpers to initialize and inode's i_uid and i_gid fields taking into account idmapped mounts making it easier for fs developers.

The xfstests I sent out all pass for both xfs and ext4:

#### xfs
1. Detached mount propagation

     ubuntu@f1-vm:~/src/git/xfstests$ sudo ./check generic/631
     FSTYP         -- xfs (non-debug)
     PLATFORM      -- Linux/x86_64 f1-vm 5.12.0-rc3-idmapped-mounts-inode-helpers #351 SMP Sat Mar 20 10:32:48 UTC 2021
     MKFS_OPTIONS  -- -f -bsize=4096 /dev/loop1
     MOUNT_OPTIONS -- /dev/loop1 /mnt/scratch
     generic/631 9s ...  11s
     Ran: generic/631
     Passed all 1 tests

2. Idmapped mounts test-suite

     ubuntu@f1-vm:~/src/git/xfstests$ sudo ./check generic/632
     FSTYP         -- xfs (non-debug)
     PLATFORM      -- Linux/x86_64 f1-vm 5.12.0-rc3-idmapped-mounts-inode-helpers #351 SMP Sat Mar 20 10:32:48 UTC 2021
     MKFS_OPTIONS  -- -f -bsize=4096 /dev/loop1
     MOUNT_OPTIONS -- /dev/loop1 /mnt/scratch
     generic/632 13s ...  14s
     Ran: generic/632
     Passed all 1 tests

3. Testing xfs quotas can't be exceeded/work correctly from idmapped mounts

     ubuntu@f1-vm:~/src/git/xfstests$ sudo ./check xfs/529
     FSTYP         -- xfs (non-debug)
     PLATFORM      -- Linux/x86_64 f1-vm 5.12.0-rc3-idmapped-mounts-inode-helpers #351 SMP Sat Mar 20 10:32:48 UTC 2021
     MKFS_OPTIONS  -- -f -bsize=4096 /dev/loop1
     MOUNT_OPTIONS -- /dev/loop1 /mnt/scratch
     xfs/529 42s ...  44s
     Ran: xfs/529
     Passed all 1 tests

4. Testing xfs qutoas on idmapped mounts

     ubuntu@f1-vm:~/src/git/xfstests$ sudo ./check xfs/530
     hFSTYP         -- xfs (non-debug)
     PLATFORM      -- Linux/x86_64 f1-vm 5.12.0-rc3-idmapped-mounts-inode-helpers #351 SMP Sat Mar 20 10:32:48 UTC 2021
     MKFS_OPTIONS  -- -f -bsize=4096 /dev/loop1
     MOUNT_OPTIONS -- /dev/loop1 /mnt/scratch
     xfs/530 20s ...  20s
     Ran: xfs/530
     Passed all 1 tests

#### ext4
1. Detached mount propagation

     ubuntu@f1-vm:~/src/git/xfstests$ sudo ./check generic/631
     FSTYP         -- ext4
     PLATFORM      -- Linux/x86_64 f1-vm 5.12.0-rc3-idmapped-mounts-inode-helpers #351 SMP Sat Mar 20 10:32:48 UTC 2021
     MKFS_OPTIONS  -- /dev/loop1
     MOUNT_OPTIONS -- -o acl,user_xattr /dev/loop1 /mnt/scratch
     generic/631 11s ...  8s
     Ran: generic/631
     Passed all 1 tests

2. Idmapped mounts test-suite

     ubuntu@f1-vm:~/src/git/xfstests$ sudo ./check generic/632
     FSTYP         -- ext4
     PLATFORM      -- Linux/x86_64 f1-vm 5.12.0-rc3-idmapped-mounts-inode-helpers #351 SMP Sat Mar 20 10:32:48 UTC 2021
     MKFS_OPTIONS  -- /dev/loop1
     MOUNT_OPTIONS -- -o acl,user_xattr /dev/loop1 /mnt/scratch
     generic/632 14s ...  10s
     Ran: generic/632
     Passed all 1 tests

3. Testing xfs quotas can't be exceeded/work correctly from idmapped mounts

     ubuntu@f1-vm:~/src/git/xfstests$ sudo ./check xfs/529
     FSTYP         -- ext4
     PLATFORM      -- Linux/x86_64 f1-vm 5.12.0-rc3-idmapped-mounts-inode-helpers #351 SMP Sat Mar 20 10:32:48 UTC 2021
     MKFS_OPTIONS  -- /dev/loop1
     MOUNT_OPTIONS -- -o acl,user_xattr /dev/loop1 /mnt/scratch

xfs/529 44s ... [not run] not suitable for this filesystem type: ext4
Ran: xfs/529
Not run: xfs/529
Passed all 1 tests

4. Testing xfs qutoas on idmapped mounts

     ubuntu@f1-vm:~/src/git/xfstests$ sudo ./check xfs/530
     FSTYP         -- ext4
     PLATFORM      -- Linux/x86_64 f1-vm 5.12.0-rc3-idmapped-mounts-inode-helpers #351 SMP Sat Mar 20 10:32:48 UTC 2021
     MKFS_OPTIONS  -- /dev/loop1
     MOUNT_OPTIONS -- -o acl,user_xattr /dev/loop1 /mnt/scratch

xfs/530 20s ... [not run] not suitable for this filesystem type: ext4
Ran: xfs/530
Not run: xfs/530
Passed all 1 tests

Thanks!
Christian

Christian Brauner (4):
fs: document mapping helpers
fs: document and rename fsid helpers
fs: introduce fsuidgid_has_mapping() helper
fs: introduce two inode i_{u,g}id initialization helpers

 fs/ext4/ialloc.c     |   2 +-
 fs/inode.c           |   4 +-
 fs/namei.c           |  11 ++--
 fs/xfs/xfs_inode.c   |  10 ++--
 fs/xfs/xfs_symlink.c |   4 +-
 include/linux/fs.h   | 124 ++++++++++++++++++++++++++++++++++++++++++-
 6 files changed, 135 insertions(+), 20 deletions(-)

base-commit: 8b12a62a4e3ed4ae99c715034f557eb391d6b196

Signature · 1 line
2.27.0