summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorMassimo Maggi <[email protected]>2013-11-03 00:40:26 +0100
committerBrian Behlendorf <[email protected]>2013-11-05 16:22:05 -0800
commitb695c34ea4ca3037cfbc0fe7a9283334b761abc1 (patch)
tree1b34e3708386e3478ceb157168b1f12c8feed8be /module/zfs
parent78e2739d3c9e433c92cd1623a510edb2c83a97d9 (diff)
Honor CONFIG_FS_POSIX_ACL kernel option
The required Posix ACL interfaces are only available for kernels with CONFIG_FS_POSIX_ACL defined. Therefore, only enable Posix ACL support for these kernels. All major distribution kernels enable CONFIG_FS_POSIX_ACL by default. If your kernel does not support Posix ACLs the following warning will be printed at ZFS module load time. "ZFS: Posix ACLs disabled by kernel" Signed-off-by: Massimo Maggi <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #1825
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/zfs_ioctl.c3
-rw-r--r--module/zfs/zfs_vfsops.c5
-rw-r--r--module/zfs/zpl_inode.c6
-rw-r--r--module/zfs/zpl_super.c2
-rw-r--r--module/zfs/zpl_xattr.c6
5 files changed, 22 insertions, 0 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
index 62387d968..9b7237f36 100644
--- a/module/zfs/zfs_ioctl.c
+++ b/module/zfs/zfs_ioctl.c
@@ -5814,6 +5814,9 @@ _init(void)
"ZFS pool version %s, ZFS filesystem version %s\n",
ZFS_META_VERSION, ZFS_META_RELEASE, ZFS_DEBUG_STR,
SPA_VERSION_STRING, ZPL_VERSION_STRING);
+#ifndef CONFIG_FS_POSIX_ACL
+ printk(KERN_NOTICE "ZFS: Posix ACLs disabled by kernel\n");
+#endif /* CONFIG_FS_POSIX_ACL */
return (0);
diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c
index 9fc6c6fe1..9097273e4 100644
--- a/module/zfs/zfs_vfsops.c
+++ b/module/zfs/zfs_vfsops.c
@@ -165,8 +165,13 @@ acltype_changed_cb(void *arg, uint64_t newval)
zsb->z_sb->s_flags &= ~MS_POSIXACL;
break;
case ZFS_ACLTYPE_POSIXACL:
+#ifdef CONFIG_FS_POSIX_ACL
zsb->z_acl_type = ZFS_ACLTYPE_POSIXACL;
zsb->z_sb->s_flags |= MS_POSIXACL;
+#else
+ zsb->z_acl_type = ZFS_ACLTYPE_OFF;
+ zsb->z_sb->s_flags &= ~MS_POSIXACL;
+#endif /* CONFIG_FS_POSIX_ACL */
break;
default:
break;
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c
index e15f0451a..98420b2fe 100644
--- a/module/zfs/zpl_inode.c
+++ b/module/zfs/zpl_inode.c
@@ -462,6 +462,7 @@ const struct inode_operations zpl_inode_operations = {
#ifdef HAVE_INODE_FALLOCATE
.fallocate = zpl_fallocate,
#endif /* HAVE_INODE_FALLOCATE */
+#if defined(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_GET_ACL)
.get_acl = zpl_get_acl,
#elif defined(HAVE_CHECK_ACL)
@@ -469,6 +470,7 @@ const struct inode_operations zpl_inode_operations = {
#elif defined(HAVE_PERMISSION)
.permission = zpl_permission,
#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
+#endif /* CONFIG_FS_POSIX_ACL */
};
const struct inode_operations zpl_dir_inode_operations = {
@@ -487,6 +489,7 @@ const struct inode_operations zpl_dir_inode_operations = {
.getxattr = generic_getxattr,
.removexattr = generic_removexattr,
.listxattr = zpl_xattr_list,
+#if defined(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_GET_ACL)
.get_acl = zpl_get_acl,
#elif defined(HAVE_CHECK_ACL)
@@ -494,6 +497,7 @@ const struct inode_operations zpl_dir_inode_operations = {
#elif defined(HAVE_PERMISSION)
.permission = zpl_permission,
#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
+#endif /* CONFIG_FS_POSIX_ACL */
};
const struct inode_operations zpl_symlink_inode_operations = {
@@ -515,6 +519,7 @@ const struct inode_operations zpl_special_inode_operations = {
.getxattr = generic_getxattr,
.removexattr = generic_removexattr,
.listxattr = zpl_xattr_list,
+#if defined(CONFIG_FS_POSIX_ACL)
#if defined(HAVE_GET_ACL)
.get_acl = zpl_get_acl,
#elif defined(HAVE_CHECK_ACL)
@@ -522,6 +527,7 @@ const struct inode_operations zpl_special_inode_operations = {
#elif defined(HAVE_PERMISSION)
.permission = zpl_permission,
#endif /* HAVE_GET_ACL | HAVE_CHECK_ACL | HAVE_PERMISSION */
+#endif /* CONFIG_FS_POSIX_ACL */
};
dentry_operations_t zpl_dentry_operations = {
diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c
index 72859ac5c..92779bcab 100644
--- a/module/zfs/zpl_super.c
+++ b/module/zfs/zpl_super.c
@@ -198,6 +198,7 @@ __zpl_show_options(struct seq_file *seq, zfs_sb_t *zsb)
{
seq_printf(seq, ",%s", zsb->z_flags & ZSB_XATTR ? "xattr" : "noxattr");
+#ifdef CONFIG_FS_POSIX_ACL
switch (zsb->z_acl_type) {
case ZFS_ACLTYPE_POSIXACL:
seq_puts(seq, ",posixacl");
@@ -206,6 +207,7 @@ __zpl_show_options(struct seq_file *seq, zfs_sb_t *zsb)
seq_puts(seq, ",noacl");
break;
}
+#endif /* CONFIG_FS_POSIX_ACL */
return (0);
}
diff --git a/module/zfs/zpl_xattr.c b/module/zfs/zpl_xattr.c
index 276ea3361..63dca3ae7 100644
--- a/module/zfs/zpl_xattr.c
+++ b/module/zfs/zpl_xattr.c
@@ -722,6 +722,8 @@ xattr_handler_t zpl_xattr_security_handler = {
.set = zpl_xattr_security_set,
};
+#ifdef CONFIG_FS_POSIX_ACL
+
int
zpl_set_acl(struct inode *ip, int type, struct posix_acl *acl)
{
@@ -1187,11 +1189,15 @@ struct xattr_handler zpl_xattr_acl_default_handler =
#endif /* HAVE_DENTRY_XATTR_LIST */
};
+#endif /* CONFIG_FS_POSIX_ACL */
+
xattr_handler_t *zpl_xattr_handlers[] = {
&zpl_xattr_security_handler,
&zpl_xattr_trusted_handler,
&zpl_xattr_user_handler,
+#ifdef CONFIG_FS_POSIX_ACL
&zpl_xattr_acl_access_handler,
&zpl_xattr_acl_default_handler,
+#endif /* CONFIG_FS_POSIX_ACL */
NULL
};