Skip to content

Commit c12db92

Browse files
committed
ovl: port to vfs{g,u}id_t and associated helpers
A while ago we introduced a dedicated vfs{g,u}id_t type in commit 1e5267c ("mnt_idmapping: add vfs{g,u}id_t"). We already switched over a good part of the VFS. Ultimately we will remove all legacy idmapped mount helpers that operate only on k{g,u}id_t in favor of the new type safe helpers that operate on vfs{g,u}id_t. Cc: Amir Goldstein <[email protected]> Cc: Christoph Hellwig <[email protected]> Reviewed-by: Seth Forshee (DigitalOcean) <[email protected]> Signed-off-by: Christian Brauner (Microsoft) <[email protected]>
1 parent a03a972 commit c12db92

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/overlayfs/util.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,13 +1104,18 @@ void ovl_copyattr(struct inode *inode)
11041104
struct path realpath;
11051105
struct inode *realinode;
11061106
struct user_namespace *real_mnt_userns;
1107+
vfsuid_t vfsuid;
1108+
vfsgid_t vfsgid;
11071109

11081110
ovl_i_path_real(inode, &realpath);
11091111
realinode = d_inode(realpath.dentry);
11101112
real_mnt_userns = mnt_user_ns(realpath.mnt);
11111113

1112-
inode->i_uid = i_uid_into_mnt(real_mnt_userns, realinode);
1113-
inode->i_gid = i_gid_into_mnt(real_mnt_userns, realinode);
1114+
vfsuid = i_uid_into_vfsuid(real_mnt_userns, realinode);
1115+
vfsgid = i_gid_into_vfsgid(real_mnt_userns, realinode);
1116+
1117+
inode->i_uid = vfsuid_into_kuid(vfsuid);
1118+
inode->i_gid = vfsgid_into_kgid(vfsgid);
11141119
inode->i_mode = realinode->i_mode;
11151120
inode->i_atime = realinode->i_atime;
11161121
inode->i_mtime = realinode->i_mtime;

0 commit comments

Comments
 (0)