summaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorNed Bass <[email protected]>2015-09-16 02:49:09 -0700
committerBrian Behlendorf <[email protected]>2015-09-19 14:04:14 -0700
commit3af56fd95fbe8b417d7ed7c9c25ef59d6f1ee161 (patch)
treef3900dad139a246b7aa961bbd30735e23299a153 /module/zfs
parent66aad10ce88f2a599365322a79f20d02f3c64393 (diff)
Honor xattr=sa dataset property
ZFS incorrectly uses directory-based extended attributes even when xattr=sa is specified as a dataset property or mount option. Support to honor temporary mount options including "xattr" was added in commit 0282c4137e7409e6d85289f4955adf07fac834f5. There are two issues with the mount option handling: * Libzfs has historically included "xattr" in its list of default mount options. This overrides the dataset property, so the dataset is always configured to use directory-based xattrs even when the xattr dataset property is set to off or sa. Address this by removing "xattr" from the set of default mount options in libzfs. * There was no way to enable system attribute-based extended attributes using temporary mount options. Add the mount options "saxattr" and "dirxattr" which enable the xattr behavior their names suggest. This approach has the advantages of mirroring the valid xattr dataset property values and following existing conventions for mount option names. Signed-off-by: Ned Bass <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3787
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/zpl_super.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c
index 80cc15725..87895d6ba 100644
--- a/module/zfs/zpl_super.c
+++ b/module/zfs/zpl_super.c
@@ -193,6 +193,8 @@ enum {
TOKEN_NOEXEC,
TOKEN_DEVICES,
TOKEN_NODEVICES,
+ TOKEN_DIRXATTR,
+ TOKEN_SAXATTR,
TOKEN_XATTR,
TOKEN_NOXATTR,
TOKEN_ATIME,
@@ -214,6 +216,8 @@ static const match_table_t zpl_tokens = {
{ TOKEN_NOEXEC, MNTOPT_NOEXEC },
{ TOKEN_DEVICES, MNTOPT_DEVICES },
{ TOKEN_NODEVICES, MNTOPT_NODEVICES },
+ { TOKEN_DIRXATTR, MNTOPT_DIRXATTR },
+ { TOKEN_SAXATTR, MNTOPT_SAXATTR },
{ TOKEN_XATTR, MNTOPT_XATTR },
{ TOKEN_NOXATTR, MNTOPT_NOXATTR },
{ TOKEN_ATIME, MNTOPT_ATIME },
@@ -262,12 +266,20 @@ zpl_parse_option(char *option, int token, substring_t *args, zfs_mntopts_t *zmo)
zmo->z_devices = B_FALSE;
zmo->z_do_devices = B_TRUE;
break;
+ case TOKEN_DIRXATTR:
+ zmo->z_xattr = ZFS_XATTR_DIR;
+ zmo->z_do_xattr = B_TRUE;
+ break;
+ case TOKEN_SAXATTR:
+ zmo->z_xattr = ZFS_XATTR_SA;
+ zmo->z_do_xattr = B_TRUE;
+ break;
case TOKEN_XATTR:
- zmo->z_xattr = B_TRUE;
+ zmo->z_xattr = ZFS_XATTR_DIR;
zmo->z_do_xattr = B_TRUE;
break;
case TOKEN_NOXATTR:
- zmo->z_xattr = B_FALSE;
+ zmo->z_xattr = ZFS_XATTR_OFF;
zmo->z_do_xattr = B_TRUE;
break;
case TOKEN_ATIME: