Fix znode group permission different from acl mask

Zp->z_mode is set at the same time inode->i_mode
is being changed. This has the effect of keeping both
in sync without relying on zfs_znode_update_vfs.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: yanping.gao <yanping.gao@xtaotech.com>
Closes #13581
This commit is contained in:
gaoyanping 2022-06-30 04:38:46 +08:00 committed by GitHub
parent 325096545a
commit e7d90362e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1001,7 +1001,7 @@ zpl_set_acl_impl(struct inode *ip, struct posix_acl *acl, int type)
* the inode to write the Posix mode bits. * the inode to write the Posix mode bits.
*/ */
if (ip->i_mode != mode) { if (ip->i_mode != mode) {
ip->i_mode = mode; ip->i_mode = ITOZ(ip)->z_mode = mode;
ip->i_ctime = current_time(ip); ip->i_ctime = current_time(ip);
zfs_mark_inode_dirty(ip); zfs_mark_inode_dirty(ip);
} }
@ -1148,7 +1148,7 @@ zpl_init_acl(struct inode *ip, struct inode *dir)
if (IS_ERR(acl)) if (IS_ERR(acl))
return (PTR_ERR(acl)); return (PTR_ERR(acl));
if (!acl) { if (!acl) {
ip->i_mode &= ~current_umask(); ITOZ(ip)->z_mode = (ip->i_mode &= ~current_umask());
ip->i_ctime = current_time(ip); ip->i_ctime = current_time(ip);
zfs_mark_inode_dirty(ip); zfs_mark_inode_dirty(ip);
return (0); return (0);
@ -1167,7 +1167,7 @@ zpl_init_acl(struct inode *ip, struct inode *dir)
mode = ip->i_mode; mode = ip->i_mode;
error = __posix_acl_create(&acl, GFP_KERNEL, &mode); error = __posix_acl_create(&acl, GFP_KERNEL, &mode);
if (error >= 0) { if (error >= 0) {
ip->i_mode = mode; ip->i_mode = ITOZ(ip)->z_mode = mode;
zfs_mark_inode_dirty(ip); zfs_mark_inode_dirty(ip);
if (error > 0) { if (error > 0) {
error = zpl_set_acl_impl(ip, acl, error = zpl_set_acl_impl(ip, acl,