Refactor inode->i_mode management

Refactor the code in such a way so that inode->i_mode is being set
at the same time zp->z_mode is being changed. This has the effect of
keeping both in sync without relying on zfs_inode_update.

Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
Closes #5158
This commit is contained in:
lorddoskias
2016-09-28 00:08:52 +03:00
committed by Brian Behlendorf
parent df7c4059cb
commit 12fa7f3436
3 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -871,7 +871,7 @@ zfs_write(struct inode *ip, uio_t *uio, int ioflag, cred_t *cr)
((zp->z_mode & S_ISUID) != 0 && uid == 0)) != 0) {
uint64_t newmode;
zp->z_mode &= ~(S_ISUID | S_ISGID);
newmode = zp->z_mode;
ip->i_mode = newmode = zp->z_mode;
(void) sa_update(zp->z_sa_hdl, SA_ZPL_MODE(zsb),
(void *)&newmode, sizeof (uint64_t), tx);
}
@@ -2993,7 +2993,7 @@ top:
if (mask & ATTR_MODE) {
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MODE(zsb), NULL,
&new_mode, sizeof (new_mode));
zp->z_mode = new_mode;
zp->z_mode = ZTOI(zp)->i_mode = new_mode;
ASSERT3P(aclp, !=, NULL);
err = zfs_aclset_common(zp, aclp, cr, tx);
ASSERT0(err);