Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jan 2010 19:09:16 +0000 (UTC)
From:      Ulf Lilleengen <lulf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r202584 - head/sys/fs/ext2fs
Message-ID:  <201001181909.o0IJ9GEG051859@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: lulf
Date: Mon Jan 18 19:09:16 2010
New Revision: 202584
URL: http://svn.freebsd.org/changeset/base/202584

Log:
  Revert parts of r202283:
  - Return EOPNOTSUPP before EROFS to be consistent with other filesystems.
  - Fix setting of the nodump flag for users without PRIV_VFS_SYSFLAGS privilege.
  
  Submitted by:	jh@

Modified:
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_vnops.c	Mon Jan 18 18:58:03 2010	(r202583)
+++ head/sys/fs/ext2fs/ext2_vnops.c	Mon Jan 18 19:09:16 2010	(r202584)
@@ -402,11 +402,12 @@ ext2_setattr(ap)
 		return (EINVAL);
 	}
 	if (vap->va_flags != VNOVAL) {
-		if (vp->v_mount->mnt_flag & MNT_RDONLY)
-			return (EROFS);
 		/* Disallow flags not supported by ext2fs. */
 		if(vap->va_flags & ~(SF_APPEND | SF_IMMUTABLE | UF_NODUMP))
-			return(EOPNOTSUPP);
+			return (EOPNOTSUPP);
+
+		if (vp->v_mount->mnt_flag & MNT_RDONLY)
+			return (EROFS);
 		/*
 		 * Callers may only modify the file flags on objects they
 		 * have VADMIN rights for.
@@ -430,9 +431,11 @@ ext2_setattr(ap)
 			ip->i_flags = vap->va_flags;
 		} else {
 			if (ip->i_flags
-			    & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND))
+			    & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) ||
+			    (vap->va_flags & UF_SETTABLE) != vap->va_flags)
 				return (EPERM);
 			ip->i_flags &= SF_SETTABLE;
+			ip->i_flags |= (vap->va_flags & UF_SETTABLE);
 		}
 		ip->i_flag |= IN_CHANGE;
 		if (vap->va_flags & (IMMUTABLE | APPEND))



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