From 2cec08a1f04d22dbad21491c68bf4c9d2d615b65 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Wed, 16 Sep 2020 15:26:06 -0400 Subject: [PATCH] Rename acltype=posixacl to acltype=posix Prefer acltype=off|posix, retaining the old names as aliases. Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #10918 --- include/sys/zfs_ioctl.h | 2 +- man/man8/zfsprops.8 | 9 ++++++--- module/os/linux/zfs/zfs_acl.c | 2 +- module/os/linux/zfs/zfs_vfsops.c | 4 ++-- module/os/linux/zfs/zpl_super.c | 2 +- module/os/linux/zfs/zpl_xattr.c | 16 ++++++++-------- module/zcommon/zfs_prop.c | 11 ++++++----- .../tests/functional/acl/posix/posix_001_pos.ksh | 4 ++-- .../tests/functional/acl/posix/posix_002_pos.ksh | 4 ++-- .../tests/functional/acl/posix/setup.ksh | 2 +- .../zpool_create/zpool_create_021_pos.ksh | 2 +- .../zpool_create/zpool_create_022_pos.ksh | 2 +- .../tests/functional/cli_user/misc/misc.cfg | 8 ++++---- .../tests/functional/history/history_002_pos.ksh | 4 ++-- .../tests/functional/rsend/rsend_012_pos.ksh | 2 +- 15 files changed, 39 insertions(+), 35 deletions(-) diff --git a/include/sys/zfs_ioctl.h b/include/sys/zfs_ioctl.h index 136075a1fc..53629cfc2c 100644 --- a/include/sys/zfs_ioctl.h +++ b/include/sys/zfs_ioctl.h @@ -67,7 +67,7 @@ extern "C" { * Property values for acltype */ #define ZFS_ACLTYPE_OFF 0 -#define ZFS_ACLTYPE_POSIXACL 1 +#define ZFS_ACLTYPE_POSIX 1 /* * Field manipulation macros for the drr_versioninfo field of the diff --git a/man/man8/zfsprops.8 b/man/man8/zfsprops.8 index b61e1179dd..2c4a2af294 100644 --- a/man/man8/zfsprops.8 +++ b/man/man8/zfsprops.8 @@ -651,7 +651,7 @@ you must first remove all .Tn ACL entries which do not represent the current mode. .El -.It Sy acltype Ns = Ns Sy off Ns | Ns Sy noacl Ns | Ns Sy posixacl +.It Sy acltype Ns = Ns Sy off Ns | Ns Sy posix Controls whether ACLs are enabled and if so what type of ACL to use. This property is not visible on FreeBSD yet. .Bl -tag -width "posixacl" @@ -662,15 +662,18 @@ property set to off then ACLs are disabled. .It Sy noacl an alias for .Sy off -.It Sy posixacl +.It Sy posix indicates POSIX ACLs should be used. POSIX ACLs are specific to Linux and are not functional on other platforms. POSIX ACLs are stored as an extended attribute and therefore will not overwrite any existing NFSv4 ACLs which may be set. +.It Sy posixacl +an alias for +.Sy posix .El .Pp To obtain the best performance when setting -.Sy posixacl +.Sy posix users are strongly encouraged to set the .Sy xattr=sa property. This will result in the POSIX ACL being stored more efficiently on diff --git a/module/os/linux/zfs/zfs_acl.c b/module/os/linux/zfs/zfs_acl.c index 8d79878c04..11b5559321 100644 --- a/module/os/linux/zfs/zfs_acl.c +++ b/module/os/linux/zfs/zfs_acl.c @@ -1153,7 +1153,7 @@ zfs_acl_chown_setattr(znode_t *zp) int error; zfs_acl_t *aclp; - if (ZTOZSB(zp)->z_acl_type == ZFS_ACLTYPE_POSIXACL) + if (ZTOZSB(zp)->z_acl_type == ZFS_ACLTYPE_POSIX) return (0); ASSERT(MUTEX_HELD(&zp->z_lock)); diff --git a/module/os/linux/zfs/zfs_vfsops.c b/module/os/linux/zfs/zfs_vfsops.c index 389200b521..15ec7b91b0 100644 --- a/module/os/linux/zfs/zfs_vfsops.c +++ b/module/os/linux/zfs/zfs_vfsops.c @@ -356,9 +356,9 @@ acltype_changed_cb(void *arg, uint64_t newval) zfsvfs->z_acl_type = ZFS_ACLTYPE_OFF; zfsvfs->z_sb->s_flags &= ~SB_POSIXACL; break; - case ZFS_ACLTYPE_POSIXACL: + case ZFS_ACLTYPE_POSIX: #ifdef CONFIG_FS_POSIX_ACL - zfsvfs->z_acl_type = ZFS_ACLTYPE_POSIXACL; + zfsvfs->z_acl_type = ZFS_ACLTYPE_POSIX; zfsvfs->z_sb->s_flags |= SB_POSIXACL; #else zfsvfs->z_acl_type = ZFS_ACLTYPE_OFF; diff --git a/module/os/linux/zfs/zpl_super.c b/module/os/linux/zfs/zpl_super.c index ec88afee90..5aaf82793f 100644 --- a/module/os/linux/zfs/zpl_super.c +++ b/module/os/linux/zfs/zpl_super.c @@ -211,7 +211,7 @@ __zpl_show_options(struct seq_file *seq, zfsvfs_t *zfsvfs) #ifdef CONFIG_FS_POSIX_ACL switch (zfsvfs->z_acl_type) { - case ZFS_ACLTYPE_POSIXACL: + case ZFS_ACLTYPE_POSIX: seq_puts(seq, ",posixacl"); break; default: diff --git a/module/os/linux/zfs/zpl_xattr.c b/module/os/linux/zfs/zpl_xattr.c index fa3c036405..9b5fd0fd39 100644 --- a/module/os/linux/zfs/zpl_xattr.c +++ b/module/os/linux/zfs/zpl_xattr.c @@ -1058,7 +1058,7 @@ zpl_init_acl(struct inode *ip, struct inode *dir) struct posix_acl *acl = NULL; int error = 0; - if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL) + if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX) return (0); if (!S_ISLNK(ip->i_mode)) { @@ -1103,7 +1103,7 @@ zpl_chmod_acl(struct inode *ip) struct posix_acl *acl; int error; - if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL) + if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX) return (0); if (S_ISLNK(ip->i_mode)) @@ -1129,7 +1129,7 @@ __zpl_xattr_acl_list_access(struct inode *ip, char *list, size_t list_size, char *xattr_name = XATTR_NAME_POSIX_ACL_ACCESS; size_t xattr_size = sizeof (XATTR_NAME_POSIX_ACL_ACCESS); - if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL) + if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX) return (0); if (list && xattr_size <= list_size) @@ -1146,7 +1146,7 @@ __zpl_xattr_acl_list_default(struct inode *ip, char *list, size_t list_size, char *xattr_name = XATTR_NAME_POSIX_ACL_DEFAULT; size_t xattr_size = sizeof (XATTR_NAME_POSIX_ACL_DEFAULT); - if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL) + if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX) return (0); if (list && xattr_size <= list_size) @@ -1168,7 +1168,7 @@ __zpl_xattr_acl_get_access(struct inode *ip, const char *name, if (strcmp(name, "") != 0) return (-EINVAL); #endif - if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL) + if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX) return (-EOPNOTSUPP); acl = zpl_get_acl(ip, type); @@ -1196,7 +1196,7 @@ __zpl_xattr_acl_get_default(struct inode *ip, const char *name, if (strcmp(name, "") != 0) return (-EINVAL); #endif - if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL) + if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX) return (-EOPNOTSUPP); acl = zpl_get_acl(ip, type); @@ -1224,7 +1224,7 @@ __zpl_xattr_acl_set_access(struct inode *ip, const char *name, if (strcmp(name, "") != 0) return (-EINVAL); #endif - if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL) + if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX) return (-EOPNOTSUPP); if (!inode_owner_or_capable(ip)) @@ -1264,7 +1264,7 @@ __zpl_xattr_acl_set_default(struct inode *ip, const char *name, if (strcmp(name, "") != 0) return (-EINVAL); #endif - if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIXACL) + if (ITOZSB(ip)->z_acl_type != ZFS_ACLTYPE_POSIX) return (-EOPNOTSUPP); if (!inode_owner_or_capable(ip)) diff --git a/module/zcommon/zfs_prop.c b/module/zcommon/zfs_prop.c index 837b8ae71b..f3dbbc15d2 100644 --- a/module/zcommon/zfs_prop.c +++ b/module/zcommon/zfs_prop.c @@ -253,9 +253,10 @@ zfs_prop_init(void) static zprop_index_t acltype_table[] = { { "off", ZFS_ACLTYPE_OFF }, - { "disabled", ZFS_ACLTYPE_OFF }, - { "noacl", ZFS_ACLTYPE_OFF }, - { "posixacl", ZFS_ACLTYPE_POSIXACL }, + { "posix", ZFS_ACLTYPE_POSIX }, + { "disabled", ZFS_ACLTYPE_OFF }, /* bkwrd compatibility */ + { "noacl", ZFS_ACLTYPE_OFF }, /* bkwrd compatibility */ + { "posixacl", ZFS_ACLTYPE_POSIX }, /* bkwrd compatibility */ { NULL } }; @@ -430,7 +431,7 @@ zfs_prop_init(void) #ifndef __FreeBSD__ zprop_register_index(ZFS_PROP_ACLTYPE, "acltype", ZFS_ACLTYPE_OFF, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT, - "noacl | posixacl", "ACLTYPE", acltype_table); + "off | posix", "ACLTYPE", acltype_table); #endif zprop_register_index(ZFS_PROP_ACLINHERIT, "aclinherit", ZFS_ACL_RESTRICTED, PROP_INHERIT, ZFS_TYPE_FILESYSTEM, @@ -705,7 +706,7 @@ zfs_prop_init(void) zprop_register_impl(ZFS_PROP_ACLTYPE, "acltype", PROP_TYPE_INDEX, ZFS_ACLTYPE_OFF, NULL, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT, - "noacl | posixacl", "ACLTYPE", B_FALSE, B_FALSE, acltype_table); + "off | posix", "ACLTYPE", B_FALSE, B_FALSE, acltype_table); #endif zprop_register_hidden(ZFS_PROP_REMAPTXG, "remaptxg", PROP_TYPE_NUMBER, PROP_READONLY, ZFS_TYPE_DATASET, "REMAPTXG"); diff --git a/tests/zfs-tests/tests/functional/acl/posix/posix_001_pos.ksh b/tests/zfs-tests/tests/functional/acl/posix/posix_001_pos.ksh index 66124fe9cc..d62bf9c346 100755 --- a/tests/zfs-tests/tests/functional/acl/posix/posix_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/acl/posix/posix_001_pos.ksh @@ -34,7 +34,7 @@ # # DESCRIPTION: -# Verify that user can access file/directory if acltype=posixacl. +# Verify that user can access file/directory if acltype=posix. # # STRATEGY: # 1. Test access to file (mode=rw-) @@ -50,7 +50,7 @@ function cleanup rmdir $TESTDIR/dir.0 } -log_assert "Verify acltype=posixacl works on file" +log_assert "Verify acltype=posix works on file" log_onexit cleanup # Test access to FILE diff --git a/tests/zfs-tests/tests/functional/acl/posix/posix_002_pos.ksh b/tests/zfs-tests/tests/functional/acl/posix/posix_002_pos.ksh index 1aceffd156..d9b5036458 100755 --- a/tests/zfs-tests/tests/functional/acl/posix/posix_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/acl/posix/posix_002_pos.ksh @@ -34,7 +34,7 @@ # # DESCRIPTION: -# Verify that user can access file/directory if acltype=posixacl. +# Verify that user can access file/directory if acltype=posix. # # STRATEGY: # 1. Test access to directory (mode=-wx) @@ -43,7 +43,7 @@ # verify_runnable "both" -log_assert "Verify acltype=posixacl works on directory" +log_assert "Verify acltype=posix works on directory" # Test access to DIRECTORY log_note "Testing access to DIRECTORY" diff --git a/tests/zfs-tests/tests/functional/acl/posix/setup.ksh b/tests/zfs-tests/tests/functional/acl/posix/setup.ksh index 5d6d158641..d8bf8a638e 100755 --- a/tests/zfs-tests/tests/functional/acl/posix/setup.ksh +++ b/tests/zfs-tests/tests/functional/acl/posix/setup.ksh @@ -46,7 +46,7 @@ default_setup_noexit $DISK log_must chmod 777 $TESTDIR # Use POSIX ACLs on filesystem -log_must zfs set acltype=posixacl $TESTPOOL/$TESTFS +log_must zfs set acltype=posix $TESTPOOL/$TESTFS log_must zfs set xattr=sa $TESTPOOL/$TESTFS log_pass diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh index 6ea1573241..655f887b60 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_021_pos.ksh @@ -68,7 +68,7 @@ set -A RW_FS_PROP "quota=536870912" \ "setuid=off" \ "readonly=on" \ "snapdir=visible" \ - "acltype=posixacl" \ + "acltype=posix" \ "aclinherit=discard" \ "canmount=off" if is_freebsd; then diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh index 349f73fecc..4a918c0a68 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_create/zpool_create_022_pos.ksh @@ -68,7 +68,7 @@ set -A RW_FS_PROP "quota=536870912" \ "setuid=off" \ "readonly=on" \ "snapdir=visible" \ - "acltype=posixacl" \ + "acltype=posix" \ "aclinherit=discard" \ "canmount=off" diff --git a/tests/zfs-tests/tests/functional/cli_user/misc/misc.cfg b/tests/zfs-tests/tests/functional/cli_user/misc/misc.cfg index af867ded53..cd0cf771e1 100644 --- a/tests/zfs-tests/tests/functional/cli_user/misc/misc.cfg +++ b/tests/zfs-tests/tests/functional/cli_user/misc/misc.cfg @@ -41,7 +41,7 @@ if is_linux; then # zfs get/set subcommands - ordered as per the list above so we # can iterate over both sets in an array PROP_VALS="\ - posixacl on \ + posix on \ fletcher2 on on \ on legacy none on \ 128K none on \ @@ -49,7 +49,7 @@ if is_linux; then # these are an alternate set of property values PROP_ALTVALS="\ - noacl off \ + off off \ fletcher4 lzjb off \ off /tmp/zfstest 100M off \ 512 10m off \ @@ -66,7 +66,7 @@ elif is_freebsd; then # zfs get/set subcommands - ordered as per the list above so we # can iterate over both sets in an array PROP_VALS="\ - posixacl on \ + posix on \ fletcher2 on on \ on legacy none on \ 128K none on \ @@ -74,7 +74,7 @@ elif is_freebsd; then # these are an alternate set of property values PROP_ALTVALS="\ - noacl off \ + off off \ fletcher4 lzjb off \ off /tmp/zfstest 100M off \ 512 10m off \ diff --git a/tests/zfs-tests/tests/functional/history/history_002_pos.ksh b/tests/zfs-tests/tests/functional/history/history_002_pos.ksh index 33fa33a4f5..b077603e82 100755 --- a/tests/zfs-tests/tests/functional/history/history_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/history/history_002_pos.ksh @@ -72,8 +72,8 @@ props=( mountpoint /history.$$ mountpoint legacy mountpoint none compression lz4 compression on compression off - compression lzjb acltype noacl - acltype posixacl xattr sa + compression lzjb acltype off + acltype posix xattr sa atime on atime off devices on devices off exec on exec off diff --git a/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh b/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh index 0441f7ff32..499c05fc98 100755 --- a/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh +++ b/tests/zfs-tests/tests/functional/rsend/rsend_012_pos.ksh @@ -116,7 +116,7 @@ for fs in "$POOL" "$POOL/pclone" "$POOL/$FS" "$POOL/$FS/fs1" \ "$POOL/$FS/fs1/fs2" "$POOL/$FS/fs1/fclone" ; do rand_set_prop $fs aclinherit "discard" "noallow" "secure" "passthrough" rand_set_prop $fs checksum "on" "off" "fletcher2" "fletcher4" "sha256" - rand_set_prop $fs acltype "off" "noacl" "posixacl" + rand_set_prop $fs acltype "off" "posix" "noacl" "posixacl" rand_set_prop $fs atime "on" "off" rand_set_prop $fs checksum "on" "off" "fletcher2" "fletcher4" "sha256" rand_set_prop $fs compression "${compress_prop_vals[@]}"