Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

erofs: support idmapped mounts

This patch enables idmapped mounts for erofs, since all dedicated helpers
for this functionality existsm, so, in this patch we just pass down the
user_namespace argument from the VFS methods to the relevant helpers.

Simple idmap example on erofs image:

1. mkdir dir
2. touch dir/file
3. mkfs.erofs erofs.img dir
4. mount -t erofs -o loop erofs.img /mnt/erofs/

5. ls -ln /mnt/erofs/
total 0
-rw-rw-r-- 1 1000 1000 0 May 17 15:26 file

6. mount-idmapped --map-mount b:1000:1001:1 /mnt/erofs/ /mnt/scratch_erofs/

7. ls -ln /mnt/scratch_erofs/
total 0
-rw-rw-r-- 1 1001 1001 0 May 17 15:26 file

Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Chao Yu <chao.yu@oppo.com>
Link: https://lore.kernel.org/r/20220517104103.3570721-1-chao@kernel.org
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

authored by

Chao Yu and committed by
Gao Xiang
6c459b78 3e917cc3

+2 -2
+1 -1
fs/erofs/inode.c
··· 365 365 stat->attributes_mask |= (STATX_ATTR_COMPRESSED | 366 366 STATX_ATTR_IMMUTABLE); 367 367 368 - generic_fillattr(&init_user_ns, inode, stat); 368 + generic_fillattr(mnt_userns, inode, stat); 369 369 return 0; 370 370 } 371 371
+1 -1
fs/erofs/super.c
··· 821 821 .name = "erofs", 822 822 .init_fs_context = erofs_init_fs_context, 823 823 .kill_sb = erofs_kill_sb, 824 - .fs_flags = FS_REQUIRES_DEV, 824 + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, 825 825 }; 826 826 MODULE_ALIAS_FS("erofs"); 827 827