From 356d9ed4c81dbb1c52627d1af242f4d9f66b67af Mon Sep 17 00:00:00 2001 From: Tim Chase Date: Tue, 7 Oct 2014 08:01:01 -0500 Subject: 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 Signed-off-by: Brian Behlendorf Closes #1264 --- module/zfs/zfs_acl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/zfs') 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); -- cgit v1.2.3