Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Aug 2008 10:03:29 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 148502 for review
Message-ID:  <200808261003.m7QA3TKo022275@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=148502

Change 148502 by trasz@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808261003.m7QA3TKo022275>