HomeFreeBSD

vfs: Add VFS/syscall support for Solaris style extended attributes

Description

vfs: Add VFS/syscall support for Solaris style extended attributes

Some systems, such as Solaris, represent extended attributes as
a set of files in a directory associated with a file object. This
allows extended attributes to be acquired/modified via regular
file system operations, such as read(2), write(2), lseek(2) and
ftruncate(2).

Since ZFS already has the capability to do this, this patch allows
system calls (and the NFSv4 client/server) such access to extended
attributes.
This permits handling of large extended attributes and allows the NFSv4
server to provide the service to NFSv4 clients that want it, such as
Windows, MacOS and Solaris.

The top level syscall change is a new open(2)/openat(2) flag I called
O_NAMEDATTR that allows the named attribute directory or any attribute
within that directory to be open'd.

The patch defines two new v_irflag flags called VIRF_NAMEDDIR and
VIRF_NAMEDATTR to indicate that the vnode is for this alternate name
space and not a normal file object.
The patch also defines flags (OPENNAMED and CREATENAMED) for VOP_LOOKUP()
to pass this new case down into VOP_LOOKUP() and MNT_NAMEDATTR for file
systems that support named attributes.

Most of the code in this patch is to avoid creation of links, symlinks
or non-regular file objects in the named attribute directory.

It also must avoid using the name cache, since the named attribute
directory is associated with the same name as the file object.

Man pages updates will be done as separate commits.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D49583

Event Timeline