changeset 10991:d59f9e6fc1f7

6888022 NFSv4: grpid mount flag is not effective for files
author Marcel Telka <Marcel.Telka@Sun.COM>
date Sat, 07 Nov 2009 02:08:39 +0100
parents 05e8539af38e
children 54a1c1cbd683
files usr/src/uts/common/fs/nfs/nfs4_vnops.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/nfs/nfs4_vnops.c	Fri Nov 06 13:57:53 2009 -0800
+++ b/usr/src/uts/common/fs/nfs/nfs4_vnops.c	Sat Nov 07 02:08:39 2009 +0100
@@ -804,15 +804,18 @@
 	if (create_flag && in_va) {
 
 		/*
-		 * If the parent's directory has the setgid bit set
+		 * If there is grpid mount flag used or
+		 * the parent's directory has the setgid bit set
 		 * _and_ the client was able to get a valid mapping
 		 * for the parent dir's owner_group, we want to
 		 * append NVERIFY(owner_group == dva.va_gid) and
 		 * SETATTR to the CREATE compound.
 		 */
 		mutex_enter(&drp->r_statelock);
-		if (drp->r_attr.va_mode & VSGID &&
+		if ((VTOMI4(dvp)->mi_flags & MI4_GRPID ||
+		    drp->r_attr.va_mode & VSGID) &&
 		    drp->r_attr.va_gid != GID_NOBODY) {
+			in_va->va_mask |= AT_GID;
 			in_va->va_gid = drp->r_attr.va_gid;
 			setgid_flag = 1;
 		}
@@ -1140,10 +1143,6 @@
 			return (e.error);
 		}
 	} else if (create_flag) {
-		/*
-		 * For setgid case, we need to:
-		 * 4:savefh(new) 5:putfh(dir) 6:getattr(dir) 7:restorefh(new)
-		 */
 		argop[1].argop = OP_SAVEFH;
 
 		argop[5].argop = OP_RESTOREFH;