mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 13:22:23 +00:00
xfs: 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
1e5267cd08
("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.
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
b0463b9dd7
commit
42b7cc1102
@ -835,9 +835,8 @@ xfs_init_new_inode(
|
|||||||
* ID or one of the supplementary group IDs, the S_ISGID bit is cleared
|
* ID or one of the supplementary group IDs, the S_ISGID bit is cleared
|
||||||
* (and only if the irix_sgid_inherit compatibility variable is set).
|
* (and only if the irix_sgid_inherit compatibility variable is set).
|
||||||
*/
|
*/
|
||||||
if (irix_sgid_inherit &&
|
if (irix_sgid_inherit && (inode->i_mode & S_ISGID) &&
|
||||||
(inode->i_mode & S_ISGID) &&
|
!vfsgid_in_group_p(i_gid_into_vfsgid(mnt_userns, inode)))
|
||||||
!in_group_p(i_gid_into_mnt(mnt_userns, inode)))
|
|
||||||
inode->i_mode &= ~S_ISGID;
|
inode->i_mode &= ~S_ISGID;
|
||||||
|
|
||||||
ip->i_disk_size = 0;
|
ip->i_disk_size = 0;
|
||||||
|
@ -558,6 +558,8 @@ xfs_vn_getattr(
|
|||||||
struct inode *inode = d_inode(path->dentry);
|
struct inode *inode = d_inode(path->dentry);
|
||||||
struct xfs_inode *ip = XFS_I(inode);
|
struct xfs_inode *ip = XFS_I(inode);
|
||||||
struct xfs_mount *mp = ip->i_mount;
|
struct xfs_mount *mp = ip->i_mount;
|
||||||
|
vfsuid_t vfsuid = i_uid_into_vfsuid(mnt_userns, inode);
|
||||||
|
vfsgid_t vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
|
||||||
|
|
||||||
trace_xfs_getattr(ip);
|
trace_xfs_getattr(ip);
|
||||||
|
|
||||||
@ -568,8 +570,8 @@ xfs_vn_getattr(
|
|||||||
stat->dev = inode->i_sb->s_dev;
|
stat->dev = inode->i_sb->s_dev;
|
||||||
stat->mode = inode->i_mode;
|
stat->mode = inode->i_mode;
|
||||||
stat->nlink = inode->i_nlink;
|
stat->nlink = inode->i_nlink;
|
||||||
stat->uid = i_uid_into_mnt(mnt_userns, inode);
|
stat->uid = vfsuid_into_kuid(vfsuid);
|
||||||
stat->gid = i_gid_into_mnt(mnt_userns, inode);
|
stat->gid = vfsgid_into_kgid(vfsgid);
|
||||||
stat->ino = ip->i_ino;
|
stat->ino = ip->i_ino;
|
||||||
stat->atime = inode->i_atime;
|
stat->atime = inode->i_atime;
|
||||||
stat->mtime = inode->i_mtime;
|
stat->mtime = inode->i_mtime;
|
||||||
|
@ -66,6 +66,8 @@ xfs_bulkstat_one_int(
|
|||||||
struct xfs_bulkstat *buf = bc->buf;
|
struct xfs_bulkstat *buf = bc->buf;
|
||||||
xfs_extnum_t nextents;
|
xfs_extnum_t nextents;
|
||||||
int error = -EINVAL;
|
int error = -EINVAL;
|
||||||
|
vfsuid_t vfsuid;
|
||||||
|
vfsgid_t vfsgid;
|
||||||
|
|
||||||
if (xfs_internal_inum(mp, ino))
|
if (xfs_internal_inum(mp, ino))
|
||||||
goto out_advance;
|
goto out_advance;
|
||||||
@ -81,14 +83,16 @@ xfs_bulkstat_one_int(
|
|||||||
ASSERT(ip != NULL);
|
ASSERT(ip != NULL);
|
||||||
ASSERT(ip->i_imap.im_blkno != 0);
|
ASSERT(ip->i_imap.im_blkno != 0);
|
||||||
inode = VFS_I(ip);
|
inode = VFS_I(ip);
|
||||||
|
vfsuid = i_uid_into_vfsuid(mnt_userns, inode);
|
||||||
|
vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
|
||||||
|
|
||||||
/* xfs_iget returns the following without needing
|
/* xfs_iget returns the following without needing
|
||||||
* further change.
|
* further change.
|
||||||
*/
|
*/
|
||||||
buf->bs_projectid = ip->i_projid;
|
buf->bs_projectid = ip->i_projid;
|
||||||
buf->bs_ino = ino;
|
buf->bs_ino = ino;
|
||||||
buf->bs_uid = from_kuid(sb_userns, i_uid_into_mnt(mnt_userns, inode));
|
buf->bs_uid = from_kuid(sb_userns, vfsuid_into_kuid(vfsuid));
|
||||||
buf->bs_gid = from_kgid(sb_userns, i_gid_into_mnt(mnt_userns, inode));
|
buf->bs_gid = from_kgid(sb_userns, vfsgid_into_kgid(vfsgid));
|
||||||
buf->bs_size = ip->i_disk_size;
|
buf->bs_size = ip->i_disk_size;
|
||||||
|
|
||||||
buf->bs_nlink = inode->i_nlink;
|
buf->bs_nlink = inode->i_nlink;
|
||||||
|
Loading…
Reference in New Issue
Block a user