[PATCH 4/4] xfs: SGI ACLs: Prepare for richacls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In case an inode has trusted.SGI_ACL_* attributes but POSIX ACLs are not
enabled, treat those attributes as normal trusted attributes and bypass the
get_acl and set_acl inode operations to prevent corrupting inode->i_mode,
inode->i_acl, or inode->i_default_acl.

Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
---
 fs/xfs/xfs_acl.c   |  5 +++++
 fs/xfs/xfs_xattr.c |  5 +++--
 fs/xfs/xfs_xattr.h | 28 ++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 2 deletions(-)
 create mode 100644 fs/xfs/xfs_xattr.h

diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index 64ffb85..bee1493 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -21,6 +21,7 @@
 #include "xfs_trans_resv.h"
 #include "xfs_mount.h"
 #include "xfs_inode.h"
+#include "xfs_xattr.h"
 #include "xfs_acl.h"
 #include "xfs_attr.h"
 #include "xfs_trace.h"
@@ -319,6 +320,8 @@ xfs_xattr_acl_get(struct dentry *dentry, const char *name,
 	struct posix_acl *acl;
 	int error;
 
+	if (!IS_POSIXACL(inode))
+		return xfs_xattr_get(dentry, name, value, size, type);
 	if (S_ISLNK(inode->i_mode))
 		return -EOPNOTSUPP;
 
@@ -350,6 +353,8 @@ xfs_xattr_acl_set(struct dentry *dentry, const char *name,
 	struct posix_acl *acl = NULL;
 	int error;
 
+	if (!IS_POSIXACL(inode))
+		return xfs_xattr_set(dentry, name, value, size, flags, type);
 	if (!inode->i_op->set_acl)
 		return -EOPNOTSUPP;
 
diff --git a/fs/xfs/xfs_xattr.c b/fs/xfs/xfs_xattr.c
index 7534cb5..78540c3 100644
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -25,13 +25,14 @@
 #include "xfs_inode.h"
 #include "xfs_attr.h"
 #include "xfs_attr_leaf.h"
+#include "xfs_xattr.h"
 #include "xfs_acl.h"
 
 #include <linux/posix_acl_xattr.h>
 #include <linux/xattr.h>
 
 
-static int
+int
 xfs_xattr_get(struct dentry *dentry, const char *name,
 		void *value, size_t size, int xflags)
 {
@@ -53,7 +54,7 @@ xfs_xattr_get(struct dentry *dentry, const char *name,
 	return asize;
 }
 
-static int
+int
 xfs_xattr_set(struct dentry *dentry, const char *name, const void *value,
 		size_t size, int flags, int xflags)
 {
diff --git a/fs/xfs/xfs_xattr.h b/fs/xfs/xfs_xattr.h
new file mode 100644
index 0000000..69560052
--- /dev/null
+++ b/fs/xfs/xfs_xattr.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2001-2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+#ifndef __XFS_XATTR_H__
+#define __XFS_XATTR_H__
+
+struct dentry;
+
+extern int xfs_xattr_get(struct dentry *dentry, const char *name, void *value,
+			 size_t size, int xflags);
+extern int xfs_xattr_set(struct dentry *dentry, const char *name,
+			 const void *value, size_t size, int flags, int xflags);
+
+#endif	/* __XFS_XATTR_H__ */
-- 
2.5.0

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux