[Acl-Devel] ea+acl+nfsacl+sec-2.4.29-0.8.73 and xfs

Nathan Scott nathans at sgi.com
Thu Dec 1 21:28:26 CET 2005


On Thu, Dec 01, 2005 at 04:52:30PM +0000, Sven Geggus wrote:
> Hi there,
> 
> I'm trying to use ea+acl+nfsacl+sec-2.4.29-0.8.73.diff in conjunction with
> 2.4.32 and xfs.
> 
> Patch works fine so anything but XFS :(

I don't know if anyones tested this.  But, it may be as simple as
adding the XFS ACL enabling patch for 2.4 -- I've attached it.

> What else do I need to enable with stock 2.4-kernel xfs Version?

This is from XFS CVS on oss.sgi.com, and it will overlap with
Andreas' patch (but the common file changes should be the same,
so you probably need only the changes in the first two files in
the patch).

cheers.

-- 
Nathan
-------------- next part --------------
%patch
Index: 2.4.x-xfs/Documentation/Configure.help
===================================================================
--- 2.4.x-xfs.orig/Documentation/Configure.help	2005-04-13 11:49:12.000000000 +1000
+++ 2.4.x-xfs/Documentation/Configure.help	2005-04-13 11:49:46.000000000 +1000
@@ -17623,6 +17623,16 @@
 
   If unsure, say N.
 
+POSIX ACL support
+CONFIG_XFS_POSIX_ACL
+  POSIX Access Control Lists (ACLs) support permissions for users and
+  groups beyond the owner/group/world scheme.
+
+  To learn more about Access Control Lists, visit the POSIX ACLs for
+  Linux website <http://acl.bestbits.at/>.
+
+  If you don't know what Access Control Lists are, say N.
+
 Tracing support (EXPERIMENTAL)
 CONFIG_XFS_TRACE
   Say Y here to get an XFS build with activity tracing enabled.
Index: 2.4.x-xfs/fs/Config.in
===================================================================
--- 2.4.x-xfs.orig/fs/Config.in	2004-11-22 12:29:08.000000000 +1100
+++ 2.4.x-xfs/fs/Config.in	2005-04-13 11:49:46.000000000 +1000
@@ -102,6 +102,7 @@
 dep_mbool '  UFS file system write support (DANGEROUS)' CONFIG_UFS_FS_WRITE $CONFIG_UFS_FS $CONFIG_EXPERIMENTAL
 
 tristate 'XFS filesystem support' CONFIG_XFS_FS
+dep_mbool    '  POSIX ACL support' CONFIG_XFS_POSIX_ACL $CONFIG_XFS_FS
 dep_mbool    '  Quota support' CONFIG_XFS_QUOTA $CONFIG_XFS_FS
 dep_mbool    '  Realtime support (EXPERIMENTAL)' CONFIG_XFS_RT $CONFIG_XFS_FS $CONFIG_EXPERIMENTAL
 dep_mbool    '  Tracing support (EXPERIMENTAL)' CONFIG_XFS_TRACE $CONFIG_XFS_FS $CONFIG_EXPERIMENTAL
Index: 2.4.x-xfs/fs/namei.c
===================================================================
--- 2.4.x-xfs.orig/fs/namei.c	2005-04-13 11:44:38.000000000 +1000
+++ 2.4.x-xfs/fs/namei.c	2005-04-13 11:49:46.000000000 +1000
@@ -1053,8 +1053,9 @@
 
 	/* Negative dentry, just create the file */
 	if (!dentry->d_inode) {
-		error = vfs_create(dir->d_inode, dentry,
-				   mode & ~current->fs->umask);
+		if (!IS_POSIXACL(dir->d_inode))
+			mode &= ~current->fs->umask;
+		error = vfs_create(dir->d_inode, dentry, mode);
 		up(&dir->d_inode->i_sem);
 		dput(nd->dentry);
 		nd->dentry = dentry;
@@ -1287,7 +1288,8 @@
 	dentry = lookup_create(&nd, 0);
 	error = PTR_ERR(dentry);
 
-	mode &= ~current->fs->umask;
+	if (!IS_POSIXACL(nd.dentry->d_inode))
+		mode &= ~current->fs->umask;
 	if (!IS_ERR(dentry)) {
 		switch (mode & S_IFMT) {
 		case 0: case S_IFREG:
@@ -1355,8 +1357,9 @@
 		dentry = lookup_create(&nd, 1);
 		error = PTR_ERR(dentry);
 		if (!IS_ERR(dentry)) {
-			error = vfs_mkdir(nd.dentry->d_inode, dentry,
-					  mode & ~current->fs->umask);
+			if (!IS_POSIXACL(nd.dentry->d_inode))
+				mode &= ~current->fs->umask;
+			error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
 			dput(dentry);
 		}
 		up(&nd.dentry->d_inode->i_sem);
Index: 2.4.x-xfs/include/linux/fs.h
===================================================================
--- 2.4.x-xfs.orig/include/linux/fs.h	2005-04-13 11:44:38.000000000 +1000
+++ 2.4.x-xfs/include/linux/fs.h	2005-04-13 11:49:46.000000000 +1000
@@ -111,6 +111,7 @@
 #define MS_MOVE		8192
 #define MS_REC		16384
 #define MS_VERBOSE	32768
+#define MS_POSIXACL	65536	/* VFS does not apply the umask */
 #define MS_ACTIVE	(1<<30)
 #define MS_NOUSER	(1<<31)
 
@@ -161,6 +162,7 @@
 #define IS_IMMUTABLE(inode)	((inode)->i_flags & S_IMMUTABLE)
 #define IS_NOATIME(inode)	(__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME))
 #define IS_NODIRATIME(inode)	__IS_FLG(inode, MS_NODIRATIME)
+#define IS_POSIXACL(inode)	__IS_FLG(inode, MS_POSIXACL)
 
 #define IS_DEADDIR(inode)	((inode)->i_flags & S_DEAD)
 
Index: 2.4.x-xfs/include/linux/posix_acl_xattr.h
===================================================================
--- 2.4.x-xfs.orig/include/linux/posix_acl_xattr.h	1970-01-01 10:00:00.000000000 +1000
+++ 2.4.x-xfs/include/linux/posix_acl_xattr.h	2005-04-13 11:49:46.000000000 +1000
@@ -0,0 +1,67 @@
+/*
+  File: linux/posix_acl_xattr.h
+
+  Extended attribute system call representation of Access Control Lists.
+
+  Copyright (C) 2000 by Andreas Gruenbacher <a.gruenbacher at computer.org>
+  Copyright (C) 2002 SGI - Silicon Graphics, Inc <linux-xfs at oss.sgi.com>
+ */
+#ifndef _POSIX_ACL_XATTR_H
+#define _POSIX_ACL_XATTR_H
+
+/* Extended attribute names */
+#define POSIX_ACL_XATTR_ACCESS	"system.posix_acl_access"
+#define POSIX_ACL_XATTR_DEFAULT	"system.posix_acl_default"
+
+/* Supported ACL a_version fields */
+#define POSIX_ACL_XATTR_VERSION	0x0002
+
+
+/* An undefined entry e_id value */
+#define ACL_UNDEFINED_ID	(-1)
+
+/* ACL entry e_tag field values */
+#define ACL_USER_OBJ		(0x01)
+#define ACL_USER		(0x02)
+#define ACL_GROUP_OBJ		(0x04)
+#define ACL_GROUP		(0x08)
+#define ACL_MASK		(0x10)
+#define ACL_OTHER		(0x20)
+
+/* ACL entry e_perm bitfield values */
+#define ACL_READ		(0x04)
+#define ACL_WRITE		(0x02)
+#define ACL_EXECUTE		(0x01)
+
+
+typedef struct {
+	__u16			e_tag;
+	__u16			e_perm;
+	__u32			e_id;
+} posix_acl_xattr_entry;
+
+typedef struct {
+	__u32			a_version;
+	posix_acl_xattr_entry	a_entries[0];
+} posix_acl_xattr_header;
+
+
+static inline size_t
+posix_acl_xattr_size(int count)
+{
+	return (sizeof(posix_acl_xattr_header) +
+		(count * sizeof(posix_acl_xattr_entry)));
+}
+
+static inline int
+posix_acl_xattr_count(size_t size)
+{
+	if (size < sizeof(posix_acl_xattr_header))
+		return -1;
+	size -= sizeof(posix_acl_xattr_header);
+	if (size % sizeof(posix_acl_xattr_entry))
+		return -1;
+	return size / sizeof(posix_acl_xattr_entry);
+}
+
+#endif	/* _POSIX_ACL_XATTR_H */

%diffstat
 Documentation/Configure.help    |   10 +++++
 fs/Config.in                    |    1 
 fs/namei.c                      |   13 ++++---
 include/linux/fs.h              |    2 +
 include/linux/posix_acl_xattr.h |   67 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 88 insertions(+), 5 deletions(-)



More information about the acl-devel mailing list