mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Cross-platform xattr user namespace compatibility
ZFS on Linux originally implemented xattr namespaces in a way that is incompatible with other operating systems. On illumos, xattrs do not have namespaces. Every xattr name is visible. FreeBSD has two universally defined namespaces: EXTATTR_NAMESPACE_USER and EXTATTR_NAMESPACE_SYSTEM. The system namespace is used for protected FreeBSD-specific attributes such as MAC labels and pnfs state. These attributes have the namespace string "freebsd:system:" prefixed to the name in the encoding scheme used by ZFS. The user namespace is used for general purpose user attributes and obeys normal access control mechanisms. These attributes have no namespace string prefixed, so xattrs written on illumos are accessible in the user namespace on FreeBSD, and xattrs written to the user namespace on FreeBSD are accessible by the same name on illumos. Linux has several xattr namespaces. On Linux, ZFS encodes the namespace in the xattr name for every namespace, including the user namespace. As a consequence, an xattr in the user namespace with the name "foo" is stored by ZFS with the name "user.foo" and therefore appears on FreeBSD and illumos to have the name "user.foo" rather than "foo". Conversely, none of the xattrs written on FreeBSD or illumos are accessible on Linux unless the name happens to be prefixed with one of the Linux xattr namespaces, in which case the namespace is stripped from the name. This makes xattrs entirely incompatible between Linux and other platforms. We want to make the encoding of user namespace xattrs compatible across platforms. A critical requirement of this compatibility is for xattrs from existing pools from FreeBSD and illumos to be accessible by the same names in the user namespace on Linux. It is also necessary that existing pools with xattrs written by Linux retain access to those xattrs by the same names on Linux. Making user namespace xattrs from Linux accessible by the correct names on other platforms is important. The handling of other namespaces is not required to be consistent. Add a fallback mechanism for listing and getting xattrs to treat xattrs as being in the user namespace if they do not match a known prefix. Do not allow setting or getting xattrs with a name that is prefixed with one of the namespace names used by ZFS on supported platforms. Allow choosing between legacy illumos and FreeBSD compatibility and legacy Linux compatibility with a new tunable. This facilitates replication and migration of pools between hosts with different compatibility needs. The tunable controls whether or not to prefix the namespace to the name. If the xattr is already present with the alternate prefix, remove it so only the new version persists. By default the platform's existing convention is used. Reviewed-by: Christian Schwarz <christian.schwarz@nutanix.com> Reviewed-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11919
This commit is contained in:
@@ -2129,6 +2129,30 @@ When enabled, the maximum number of pending allocations per top-level vdev
|
||||
is limited by
|
||||
.Sy zfs_vdev_queue_depth_pct .
|
||||
.
|
||||
.It Sy zfs_xattr_compat Ns = Ns 0 Ns | Ns 1 Pq int
|
||||
Control the naming scheme used when setting new xattrs in the user namespace.
|
||||
If
|
||||
.Sy 0
|
||||
.Pq the default on Linux ,
|
||||
user namespace xattr names are prefixed with the namespace, to be backwards
|
||||
compatible with previous versions of ZFS on Linux.
|
||||
If
|
||||
.Sy 1
|
||||
.Pq the default on Fx ,
|
||||
user namespace xattr names are not prefixed, to be backwards compatible with
|
||||
previous versions of ZFS on illumos and
|
||||
.Fx .
|
||||
.Pp
|
||||
Either naming scheme can be read on this and future versions of ZFS, regardless
|
||||
of this tunable, but legacy ZFS on illumos or
|
||||
.Fx
|
||||
are unable to read user namespace xattrs written in the Linux format, and
|
||||
legacy versions of ZFS on Linux are unable to read user namespace xattrs written
|
||||
in the legacy ZFS format.
|
||||
.Pp
|
||||
An existing xattr with the alternate naming scheme is removed when overwriting
|
||||
the xattr so as to not accumulate duplicates.
|
||||
.
|
||||
.It Sy zio_requeue_io_start_cut_in_line Ns = Ns Sy 0 Ns | Ns 1 Pq int
|
||||
Prioritize requeued I/O.
|
||||
.
|
||||
|
||||
Reference in New Issue
Block a user