PERFORCE change 164509 for review

Aditya Sarawgi truncs at FreeBSD.org
Tue Jun 16 15:45:28 UTC 2009


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

Change 164509 by truncs at aditya on 2009/06/16 15:45:15

	First a check should be made for VNOVAL and then UF_* flag check should be made otherwise it won't allow mkdir to create a dir with a 
	different attribute than the parent dir and it also gives random write errors.

Affected files ...

.. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_vnops.c#10 edit

Differences ...

==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_vnops.c#10 (text+ko) ====

@@ -243,7 +243,7 @@
 
 	if (ap->a_vp->v_type == VBLK || ap->a_vp->v_type == VCHR)
 		return (EOPNOTSUPP);
-
+	
 	/*
 	 * Files marked append-only must be opened for appending.
 	 */
@@ -295,7 +295,7 @@
 
 	if (vp->v_type == VBLK || vp->v_type == VCHR)
 		return (EOPNOTSUPP);
-
+	
 	/*
 	 * Disallow write attempts on read-only file systems;
 	 * unless the file is a socket, fifo, or a block or
@@ -380,12 +380,6 @@
 	struct thread *td = curthread;
 	int error;
 	/*
-	 * Deny setting of UF flags
-	 */
-	if(vap->va_flags & UF_SETTABLE)
-		return (EOPNOTSUPP);
-
-	/*
 	 * Check for unsettable attributes.
 	 */
 	if ((vap->va_type != VNON) || (vap->va_nlink != VNOVAL) ||
@@ -397,7 +391,11 @@
 	if (vap->va_flags != VNOVAL) {
 		if (vp->v_mount->mnt_flag & MNT_RDONLY)
 			return (EROFS);
-	
+		/* 
+		 * Deny setting of UF flags
+		 */
+		if(vap->va_flags & UF_SETTABLE)
+			return(EOPNOTSUPP);	
 		/*
 		 * Callers may only modify the file flags on objects they
 		 * have VADMIN rights for.
@@ -421,11 +419,9 @@
 			ip->i_flags = vap->va_flags;
 		} else {
 			if (ip->i_flags
-			    & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) ||
-			    (vap->va_flags & UF_SETTABLE) != vap->va_flags)
+			    & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND))
 				return (EPERM);
 			ip->i_flags &= SF_SETTABLE;
-			ip->i_flags |= (vap->va_flags & UF_SETTABLE);
 		}
 		ip->i_flag |= IN_CHANGE;
 		if (vap->va_flags & (SF_IMMUTABLE | SF_APPEND))
@@ -1177,7 +1173,6 @@
 	if (cnp->cn_flags & ISWHITEOUT)
 		ip->i_flags |= UF_OPAQUE;
 	error = ext2_update(tvp, 1);
-
 	/*
 	 * Bump link count in parent directory
 	 * to reflect work done below.  Should
@@ -1189,7 +1184,6 @@
 	error = ext2_update(dvp, 1);
 	if (error)
 		goto bad;
-
 	/* Initialize directory with "." and ".." from static template. */
 	if (EXT2_HAS_INCOMPAT_FEATURE(ip->i_e2fs,
 	    EXT2F_INCOMPAT_FTYPE))


More information about the p4-projects mailing list