summaryrefslogtreecommitdiffstats
path: root/include/linux/xattr_compat.h
diff options
context:
space:
mode:
authorMassimo Maggi <[email protected]>2013-10-28 09:22:15 -0700
committerBrian Behlendorf <[email protected]>2013-10-29 14:54:26 -0700
commit023699cd62eb033ebed5e5fae4e13acaba4c5461 (patch)
treecc36188907422afa2ae4f74c217760d5379805b4 /include/linux/xattr_compat.h
parent7c2448a33ee71be1671c158a167559d1320ff839 (diff)
Posix ACL Support
This change adds support for Posix ACLs by storing them as an xattr which is common practice for many Linux file systems. Since the Posix ACL is stored as an xattr it will not overwrite any existing ZFS/NFSv4 ACLs which may have been set. The Posix ACL will also be non-functional on other platforms although it may be visible as an xattr if that platform understands SA based xattrs. By default Posix ACLs are disabled but they may be enabled with the new 'aclmode=noacl|posixacl' property. Set the property to 'posixacl' to enable them. If ZFS/NFSv4 ACL support is ever added an appropriate acltype will be added. This change passes the POSIX Test Suite cleanly with the exception of xacl/00.t test 45 which is incorrect for Linux (Ext4 fails too). http://www.tuxera.com/community/posix-test-suite/ Signed-off-by: Massimo Maggi <[email protected]> Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #170
Diffstat (limited to 'include/linux/xattr_compat.h')
-rw-r--r--include/linux/xattr_compat.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/xattr_compat.h b/include/linux/xattr_compat.h
index 84d8fdeb8..f06ba1fa0 100644
--- a/include/linux/xattr_compat.h
+++ b/include/linux/xattr_compat.h
@@ -26,6 +26,8 @@
#ifndef _ZFS_XATTR_H
#define _ZFS_XATTR_H
+#include <linux/posix_acl_xattr.h>
+
/*
* 2.6.35 API change,
* The const keyword was added to the 'struct xattr_handler' in the
@@ -92,4 +94,37 @@ fn(struct inode *ip, const char *name, const void *buffer, \
security_inode_init_security(ip, dip, nm, val, len)
#endif /* HAVE_6ARGS_SECURITY_INODE_INIT_SECURITY */
+/*
+ * Linux 3.7 API change. posix_acl_{from,to}_xattr gained the user_ns
+ * parameter. For the HAVE_POSIX_ACL_FROM_XATTR_USERNS version the
+ * userns _may_ not be correct because it's used outside the RCU.
+ */
+#ifdef HAVE_POSIX_ACL_FROM_XATTR_USERNS
+static inline struct posix_acl *
+zpl_acl_from_xattr(const void *value, int size)
+{
+ return posix_acl_from_xattr(CRED()->user_ns, value, size);
+}
+
+static inline int
+zpl_acl_to_xattr(struct posix_acl *acl, void *value, int size)
+{
+ return posix_acl_to_xattr(CRED()->user_ns,acl, value, size);
+}
+
+#else
+
+static inline struct posix_acl *
+zpl_acl_from_xattr(const void *value,int size)
+{
+ return posix_acl_from_xattr(value, size);
+}
+
+static inline int
+zpl_acl_to_xattr(struct posix_acl *acl, void *value, int size)
+{
+ return posix_acl_to_xattr(acl, value, size);
+}
+#endif /* HAVE_POSIX_ACL_FROM_XATTR_USERNS */
+
#endif /* _ZFS_XATTR_H */