Bug #7444

fs/xattr.c should be more transparent

Added by Gordon Ross over 4 years ago. Updated over 3 years ago.

filesystems (not ZFS)
Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:



The implementation of Extensible Attributes (PSARC/2007/315)
uses what could be described as a layered file system module
to handle all access to the special extended attribute files
SUNWattr_ro and SUNWattr_rw. This layered module is found in
$SRC/uts/common/fs/xattr.c, referred to hereafter as fs/xattr.
Filesystems that indicate support for (PSARC/2007/315) have
fs/xattr layered above them by code in vnode.c:fop_lookup.

When the filesystem below fs/xattr supports extended attributes,
fs/xattr implements vnode operations (VOP) for objects other than
SUNWattr_ro or SUNWattr_rw by passing the VOP calls through to
the underlying filesystem. These "pass-through" VOP calls look
to the underlying filesystem much the same as when the fs/xattr
module layer is not in use, so this layer is mostly transparent
to the underlying filesystem.


The pass-through VOP calls in fs/xattr lack transparency in
two respects: (1) open and close are not passed through,
and (2) vnode hold lifetimes are much shorter when fs/xattr
is in use.

Problem 1: Missing open/close calls (and solution)

In some filesystems such as nfs(v4) and smbfs, the open/close
VOP calls need to maintain some state (i.e. remote handles).
While both nfs(v4) and smbfs use open/close calls, only smbfs
is affected by the missign open/close because nfs does not
currently implement the Extensible Attributes feature.

Adding logic to pass through open/close calls is trivial,
and ignored by file systems that don't need them.

Problem 2: Shortened hold times (and solution)

The fs/xattr module has some misguided comments at the top
about avoiding vnode hold times. That makes no sense.
Short hold times are advantageous for mutex locks etc,
but holding a vnode reference through an operation is
actually preferred (and more efficient) than droppping
that hold only to have to lookup the vnode again soon.

This enhancement lets fs/xattr keep the vnode hold on
the lower file system vnode for the same duration as
the hold on the xattr directory vnode. Not only is this
more efficient (avoiding extra vnode lookup/reclaims)
but simplifies many operations in the fs/xattr code.

Related issues

Related to illumos gate - Bug #8102: zfs-tests suite fails zfs_acl_chmod_xattr_001_posClosedYuri Pankov2017-04-24


Also available in: Atom PDF