Add a tiny wrapper to retrieve the upper mount's idmapping. Have it return the initial idmapping until we have prepared and converted all places to take the relevant idmapping into account. Then we can switch on idmapped layer support by having ovl_upper_mnt_userns() return the upper mount's idmapping. Suggested-by: Miklos Szeredi <mszeredi@xxxxxxxxxx> Reviewed-by: Amir Goldstein <amir73il@xxxxxxxxx> Signed-off-by: Christian Brauner (Microsoft) <brauner@xxxxxxxxxx> --- /* v2 */ - Miklos Szeredi <mszeredi@xxxxxxxxxx>: - Add separate patch for ovl_upper_idmap() and have it return the initial idmapping until we turn idmapped layer support on later. /* v3 */ unchanged /* v4 */ - Vivek Goyal <vgoyal@xxxxxxxxxx>: - s/ovl_upper_idmap()/ovl_upper_mnt_userns()/g /* v5 */ unchanged --- fs/overlayfs/ovl_entry.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h index 63efee554f69..1c6495bc6bb3 100644 --- a/fs/overlayfs/ovl_entry.h +++ b/fs/overlayfs/ovl_entry.h @@ -90,6 +90,11 @@ static inline struct vfsmount *ovl_upper_mnt(struct ovl_fs *ofs) return ofs->layers[0].mnt; } +static inline struct user_namespace *ovl_upper_mnt_userns(struct ovl_fs *ofs) +{ + return &init_user_ns; +} + static inline struct ovl_fs *OVL_FS(struct super_block *sb) { return (struct ovl_fs *)sb->s_fs_info; -- 2.32.0