diff options
author | Nikolay Borisov <[email protected]> | 2016-05-22 14:15:57 +0300 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-07-25 13:21:49 -0700 |
commit | 2c6abf15ff5bcc979653eef0131f90d4f0fede21 (patch) | |
tree | 29bc74006a16d50335196ccd1e7459b569e48b57 /module/zfs/zfs_znode.c | |
parent | 82a1b2d6289f9ceae0bee6f1e71d3bc29a8c5d16 (diff) |
Remove znode's z_uid/z_gid member
Remove duplicate z_uid/z_gid member which are also held in the
generic vfs inode struct. This is done by first removing the members
from struct znode and then using the KUID_TO_SUID/KGID_TO_SGID
macros to access the respective member from struct inode. In cases
where the uid/gids are being marshalled from/to disk, use the newly
introduced zfs_(uid|gid)_(read|write) functions to properly
save the uids rather than the internal kernel representation.
Signed-off-by: Nikolay Borisov <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #4685
Issue #227
Diffstat (limited to 'module/zfs/zfs_znode.c')
-rw-r--r-- | module/zfs/zfs_znode.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/module/zfs/zfs_znode.c b/module/zfs/zfs_znode.c index ac49c95a5..b43b576e8 100644 --- a/module/zfs/zfs_znode.c +++ b/module/zfs/zfs_znode.c @@ -533,8 +533,6 @@ zfs_inode_update_impl(znode_t *zp, boolean_t new) dmu_object_size_from_db(sa_get_db(zp->z_sa_hdl), &blksize, &i_blocks); spin_lock(&ip->i_lock); - ip->i_uid = SUID_TO_KUID(zp->z_uid); - ip->i_gid = SGID_TO_KGID(zp->z_gid); ip->i_mode = zp->z_mode; zfs_set_inode_flags(zp, ip); ip->i_blkbits = SPA_MINBLOCKSHIFT; @@ -582,6 +580,7 @@ zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz, uint64_t parent; uint64_t tmp_gen; uint64_t links; + uint64_t z_uid, z_gid; sa_bulk_attr_t bulk[8]; int count = 0; @@ -621,8 +620,8 @@ zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz, &zp->z_pflags, 8); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_PARENT(zsb), NULL, &parent, 8); - SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_UID(zsb), NULL, &zp->z_uid, 8); - SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GID(zsb), NULL, &zp->z_gid, 8); + SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_UID(zsb), NULL, &z_uid, 8); + SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GID(zsb), NULL, &z_gid, 8); if (sa_bulk_lookup(zp->z_sa_hdl, bulk, count) != 0 || tmp_gen == 0) { @@ -636,6 +635,8 @@ zfs_znode_alloc(zfs_sb_t *zsb, dmu_buf_t *db, int blksz, zp->z_mode = mode; ip->i_generation = (uint32_t)tmp_gen; set_nlink(ip, (uint32_t)links); + zfs_uid_write(ip, z_uid); + zfs_gid_write(ip, z_gid); ip->i_ino = obj; zfs_inode_update_new(zp); @@ -1159,6 +1160,7 @@ zfs_rezget(znode_t *zp) int err; int count = 0; uint64_t gen; + uint64_t z_uid, z_gid; znode_hold_t *zh; /* @@ -1216,9 +1218,9 @@ zfs_rezget(znode_t *zp) SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_FLAGS(zsb), NULL, &zp->z_pflags, sizeof (zp->z_pflags)); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_UID(zsb), NULL, - &zp->z_uid, sizeof (zp->z_uid)); + &z_uid, sizeof (z_uid)); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GID(zsb), NULL, - &zp->z_gid, sizeof (zp->z_gid)); + &z_gid, sizeof (z_gid)); SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MODE(zsb), NULL, &mode, sizeof (mode)); @@ -1229,6 +1231,8 @@ zfs_rezget(znode_t *zp) } zp->z_mode = mode; + zfs_uid_write(ZTOI(zp), z_uid); + zfs_gid_write(ZTOI(zp), z_gid); if (gen != ZTOI(zp)->i_generation) { zfs_znode_dmu_fini(zp); |