summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Chase <tim@chase2k.com>2014-10-07 08:01:01 -0500
committerBrian Behlendorf <behlendorf1@llnl.gov>2014-10-21 09:23:27 -0700
commit356d9ed4c81dbb1c52627d1af242f4d9f66b67af (patch)
tree09935bdae807e864869c11d3d3d2ee1ee3416ef3
parent62bdd5eb7a35288cc25c5ae968bcd0f08889f986 (diff)
Don't perform ACL-to-mode translation on empty ACL
In zfs_acl_chown_setattr(), the zfs_mode_comput() function is used to create a traditional mode value based on an ACL. If no ACL exists, this processing shouldn't be done. Problems caused by this were most evident on version 4 filesystems which not only don't have system attributes, and also frequently have empty ACLs. On such filesystems, performing a chown() operation could have the effect of dirtying the mode bits in memory but not on the file system as follows: # create a file with typical mode of 664 echo test > test chown anyuser test ls -l test and the mode will show up as all zeroes. Unmounting/mounting and/or exporting/importing the filesystem will reveal the proper mode again. Signed-off-by: Tim Chase <tim@chase2k.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #1264
-rw-r--r--module/zfs/zfs_acl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/module/zfs/zfs_acl.c b/module/zfs/zfs_acl.c
index 89b624528..f3eb6c3dd 100644
--- a/module/zfs/zfs_acl.c
+++ b/module/zfs/zfs_acl.c
@@ -1162,7 +1162,8 @@ zfs_acl_chown_setattr(znode_t *zp)
ASSERT(MUTEX_HELD(&zp->z_lock));
ASSERT(MUTEX_HELD(&zp->z_acl_lock));
- if ((error = zfs_acl_node_read(zp, B_TRUE, &aclp, B_FALSE)) == 0)
+ error = zfs_acl_node_read(zp, B_TRUE, &aclp, B_FALSE);
+ if (error == 0 && aclp->z_acl_count > 0)
zp->z_mode = zfs_mode_compute(zp->z_mode, aclp,
&zp->z_pflags, zp->z_uid, zp->z_gid);