On 10/12/2009 04:38 PM, Paul B. Henson wrote:
I only have ZFS filesystems exported right now, but I assume it would behave the same for ufs. The underlying issue seems to be the Sun NFS server expects the NFS client to apply the sgid bit itself and create the new directory with the parent directory's group, while the Linux NFS client expects the server to enforce the sgid bit.
When the clients send the opcode CREATE, the Solaris client specifies the parent directory's group in attr_vals whereas the Linux client doesn't specify a group. There appears to be a disparity between the servers in what to do in an SGID directory when attr_vals does not specify a group. On Solaris, this leads the server to use the process' group, but on Linux, the SGID is enforced and it takes the group of the parent directory. The problem arises when the Linux client expects the Linux server's behavior, leading it to not send the group to a Solaris server, leading the Solaris server to assume the client wanted to ignore the SGID bit.
This issue has been frustrating because there didn't appear to be any official word on which client was right. However, I did find this in the RFC which may indicate that the Solaris server might be at fault. In 14.2.4, for the opcode CREATE, it says this about situations where the group isn't specified:
Similarly, if createattrs includes neither the group attribute nor a group ACE, and if the server's filesystem both supports and requires the notion of a group attribute (or group ACE), the server MUST derive the group attribute (or the corresponding owner ACE) for the file. This could be from the RPC call's credentials, such as the group principal if the credentials include it (such as with AUTH_SYS), from the group identifier associated with the principal in the credentials (for e.g., POSIX systems have a passwd database that has the group identifier for every user identifier), inherited from directory the object is created in, or whatever else the server's operating environment or filesystem semantics dictate. This applies to the OPEN operation too.
The important phrase being "inherited from directory the object is created in", which says to me that the server should enforce the SGID bit if no group is specified. However, reading this closer makes me wonder if this sentence is too open-ended. It appears that the Solaris server uses a group principle or group identifier and the Linux server inherits from the parent directory. Both of these are valid choices from the list...they just happen to make incompatible implementations.
_______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss