svn commit: r201497 - stable/8/sys/gnu/fs/ext2fs

Jaakko Heinonen jh at FreeBSD.org
Mon Jan 4 14:35:36 UTC 2010


Author: jh
Date: Mon Jan  4 14:35:36 2010
New Revision: 201497
URL: http://svn.freebsd.org/changeset/base/201497

Log:
  MFC r198940:
  
  File flags handling fixes for ext2fs:
  
  - Disallow setting of flags not supported by ext2fs.
  - Map EXT2_APPEND_FL to SF_APPEND.
  - Map EXT2_IMMUTABLE_FL to SF_IMMUTABLE.
  - Map EXT2_NODUMP_FL to UF_NODUMP.
  
  Note that ext2fs doesn't support user settable append and immutable flags.
  EXT2_NODUMP_FL is an user settable flag also on Linux.
  
  PR:		kern/122047
  Approved by:	trasz (mentor)

Modified:
  stable/8/sys/gnu/fs/ext2fs/ext2_inode_cnv.c
  stable/8/sys/gnu/fs/ext2fs/ext2_vnops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/gnu/fs/ext2fs/ext2_inode_cnv.c
==============================================================================
--- stable/8/sys/gnu/fs/ext2fs/ext2_inode_cnv.c	Mon Jan  4 14:34:01 2010	(r201496)
+++ stable/8/sys/gnu/fs/ext2fs/ext2_inode_cnv.c	Mon Jan  4 14:35:36 2010	(r201497)
@@ -83,8 +83,9 @@ ext2_ei2i(ei, ip)
 	ip->i_mtime = ei->i_mtime;
 	ip->i_ctime = ei->i_ctime;
 	ip->i_flags = 0;
-	ip->i_flags |= (ei->i_flags & EXT2_APPEND_FL) ? APPEND : 0;
-	ip->i_flags |= (ei->i_flags & EXT2_IMMUTABLE_FL) ? IMMUTABLE : 0;
+	ip->i_flags |= (ei->i_flags & EXT2_APPEND_FL) ? SF_APPEND : 0;
+	ip->i_flags |= (ei->i_flags & EXT2_IMMUTABLE_FL) ? SF_IMMUTABLE : 0;
+	ip->i_flags |= (ei->i_flags & EXT2_NODUMP_FL) ? UF_NODUMP : 0;
 	ip->i_blocks = ei->i_blocks;
 	ip->i_gen = ei->i_generation;
 	ip->i_uid = ei->i_uid;
@@ -121,8 +122,9 @@ ext2_i2ei(ip, ei)
 	ei->i_ctime = ip->i_ctime;
 	ei->i_flags = ip->i_flags;
 	ei->i_flags = 0;
-	ei->i_flags |= (ip->i_flags & APPEND) ? EXT2_APPEND_FL: 0;
-	ei->i_flags |= (ip->i_flags & IMMUTABLE) ? EXT2_IMMUTABLE_FL: 0;
+	ei->i_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND_FL: 0;
+	ei->i_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE_FL: 0;
+	ei->i_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP_FL : 0;
 	ei->i_blocks = ip->i_blocks;
 	ei->i_generation = ip->i_gen;
 	ei->i_uid = ip->i_uid;

Modified: stable/8/sys/gnu/fs/ext2fs/ext2_vnops.c
==============================================================================
--- stable/8/sys/gnu/fs/ext2fs/ext2_vnops.c	Mon Jan  4 14:34:01 2010	(r201496)
+++ stable/8/sys/gnu/fs/ext2fs/ext2_vnops.c	Mon Jan  4 14:35:36 2010	(r201497)
@@ -391,6 +391,10 @@ ext2_setattr(ap)
 		return (EINVAL);
 	}
 	if (vap->va_flags != VNOVAL) {
+		/* Disallow flags not supported by ext2fs. */
+		if (vap->va_flags & ~(SF_APPEND | SF_IMMUTABLE | UF_NODUMP))
+			return (EOPNOTSUPP);
+
 		if (vp->v_mount->mnt_flag & MNT_RDONLY)
 			return (EROFS);
 		/*


More information about the svn-src-all mailing list