Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD: Implement xattr=sa #11997

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/libzfs/os/freebsd/libzfs_zmount.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ do_mount_(const char *spec, const char *dir, int mflag, char *fstype,
iovlen = 0;
if (strstr(optstr, MNTOPT_REMOUNT) != NULL)
build_iovec(&iov, &iovlen, "update", NULL, 0);
if (strstr(optstr, MNTOPT_NOXATTR) == NULL &&
strstr(optstr, MNTOPT_XATTR) == NULL &&
strstr(optstr, MNTOPT_SAXATTR) == NULL &&
strstr(optstr, MNTOPT_DIRXATTR) == NULL)
build_iovec(&iov, &iovlen, "xattr", NULL, 0);
if (mflag & MS_RDONLY)
build_iovec(&iov, &iovlen, "ro", NULL, 0);
build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1);
Expand Down
9 changes: 6 additions & 3 deletions man/man8/zfsprops.8
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
.\" Copyright 2019 Joyent, Inc.
.\" Copyright (c) 2019, Kjeld Schouten-Lebbing
.\"
.Dd September 1, 2020
.Dd May 5, 2021
.Dt ZFSPROPS 8
.Os
.Sh NAME
Expand Down Expand Up @@ -1778,7 +1778,7 @@ The default value is
This property is not used by OpenZFS.
.It Sy xattr Ns = Ns Sy on Ns | Ns Sy off Ns | Ns Sy sa
Controls whether extended attributes are enabled for this file system. Two
styles of extended attributes are supported either directory based or system
styles of extended attributes are supported: either directory based or system
attribute based.
.Pp
The default value of
Expand All @@ -1790,7 +1790,7 @@ can be set on a file. Although under Linux the
and
.Xr setxattr 2
system calls limit the maximum size to 64K. This is the most compatible
style of extended attribute and is supported by all OpenZFS implementations.
style of extended attribute and is supported by all ZFS implementations.
.Pp
System attribute based xattrs can be enabled by setting the value to
.Sy sa .
Expand All @@ -1803,6 +1803,9 @@ based xattr. System attribute based extended attributes are not accessible
on platforms which do not support the
.Sy xattr=sa
feature.
OpenZFS supports
.Sy xattr=sa
on both FreeBSD and Linux.
.Pp
The use of system attribute based xattrs is strongly encouraged for users of
SELinux or POSIX ACLs. Both of these features heavily rely on extended
Expand Down
4 changes: 4 additions & 0 deletions module/os/freebsd/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,10 @@ zfsvfs_init(zfsvfs_t *zfsvfs, objset_t *os)
&sa_obj);
if (error != 0)
return (error);

error = zfs_get_zplprop(os, ZFS_PROP_XATTR, &val);
if (error == 0 && val == ZFS_XATTR_SA)
zfsvfs->z_xattr_sa = B_TRUE;
}

error = sa_setup(os, sa_obj, zfs_attr_table, ZPL_END,
Expand Down
Loading