zfsonlinux/zfs — pull request #2768 by dweeezil (2014-10-07 13:08:03+00:00)
Title: 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,
but also don't typically have 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.

Fixes #1264