PERFORCE change 148502 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Tue Aug 26 10:03:30 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=148502

Change 148502 by trasz at trasz_traszkan on 2008/08/26 10:03:16

	Fix flags handling, _again_ ;-/
	
	With this change, the kernel passes the fstest.

Affected files ...

.. //depot/projects/soc2008/trasz_nfs4acl/sys/ufs/ufs/ufs_vnops.c#17 edit

Differences ...

==== //depot/projects/soc2008/trasz_nfs4acl/sys/ufs/ufs/ufs_vnops.c#17 (text+ko) ====

@@ -320,7 +320,7 @@
 	 * unless the file is a socket, fifo, or a block or
 	 * character device resident on the filesystem.
 	 */
-	if (mode & (VWRITE | VAPPEND)) {
+	if (mode & VMODIFY_PERMS) {
 		switch (vp->v_type) {
 		case VDIR:
 		case VLNK:
@@ -333,8 +333,13 @@
 		}
 	}
 
-	/* If immutable bit set, nobody gets to write it. */
-	if ((mode & (VWRITE | VAPPEND)) && (ip->i_flags & (IMMUTABLE | SF_SNAPSHOT)))
+	/*
+	 * If immutable bit set, nobody gets to write it.
+	 * "& ~VADMIN_PERMS" is here, because without it,
+	 * it would be impossible to remove the IMMUTABLE flag.
+	 */
+	if ((mode & (VMODIFY_PERMS & ~VADMIN_PERMS)) &&
+	    (ip->i_flags & (IMMUTABLE | SF_SNAPSHOT)))
 		return (EPERM);
 
 #ifdef UFS_ACL


More information about the p4-projects mailing list