freebsd-skq/sys/ufs/ufs
Konstantin Belousov 08c2dc2841 ufs_direnter/SU: unconditionally UFS_UPDATE inode when extending directory
for all kinds of async/SU mount variants.

Submitted by:	mckusick
Reviewed by:	chs
Tested by:	pho
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2021-02-12 03:02:20 +02:00
..
acl.h
dinode.h Continuing efforts to provide hardening of FFS. This change adds a 2018-12-11 22:14:37 +00:00
dir.h Simplify calculation of DIRECTSIZ. No functional change intended. 2019-05-03 21:46:25 +00:00
dirhash.h ufs: clean up empty lines in .c and .h files 2020-09-01 21:23:00 +00:00
extattr.h UFS2: Fix DoS due to corrupted extattrfile 2020-10-30 19:00:42 +00:00
gjournal.h
inode.h Add a framework that tracks exclusive vnode lock generation count for UFS. 2020-11-14 05:10:39 +00:00
quota.h
README.acls
README.extattr
ufs_acl.c ufs: clean up empty lines in .c and .h files 2020-09-01 21:23:00 +00:00
ufs_bmap.c ufs: clean up empty lines in .c and .h files 2020-09-01 21:23:00 +00:00
ufs_dirhash.c ufs: clean up empty lines in .c and .h files 2020-09-01 21:23:00 +00:00
ufs_extattr.c ufs: catch up with removal of thread argument from VOP_INACTIVE 2020-10-20 09:46:20 +00:00
ufs_extern.h Merge ufs_fhtovp() into ffs_inotovp(). 2021-02-12 03:02:20 +02:00
ufs_gjournal.c Update ffs_getcg() function to accept a flags parameter to be passed 2019-10-04 05:28:36 +00:00
ufs_inode.c Handle LoR in flush_pagedep_deps(). 2020-11-14 05:30:10 +00:00
ufs_lookup.c ufs_direnter/SU: unconditionally UFS_UPDATE inode when extending directory 2021-02-12 03:02:20 +02:00
ufs_quota.c vfs: remove the thread argument from vget 2020-08-16 17:18:54 +00:00
ufs_vfsops.c Merge ufs_fhtovp() into ffs_inotovp(). 2021-02-12 03:02:20 +02:00
ufs_vnops.c ffs: call ufsdirhash_dirtrunc() right after setting directory size 2021-02-12 03:02:19 +02:00
ufsmount.h This commit enables a UFS filesystem to do a forcible unmount when 2020-05-25 23:47:31 +00:00

$FreeBSD$

  UFS Extended Attributes Copyright

The UFS Extended Attributes implementation is copyright Robert Watson, and
is made available under a Berkeley-style license.

  About UFS Extended Attributes

Extended attributes allow the association of additional arbitrary
meta-data with files and directories.  Extended attributes are defined in
the form name=value, where name is an nul-terminated string in the style
of a filename, and value is a binary blob of zero or more bytes. The UFS
extended attribute service layers support for extended attributes onto a
backing file, in the style of the quota implementation, meaning that it
requires no underlying format changes in the filesystem.  This design
choice exchanges simplicity, usability and easy deployment for
performance.  When defined, extended attribute names exist in a series of
disjoint namespaces: currently, two namespaces are defined:
EXTATTR_NAMESPACE_SYSTEM and EXTATTR_NAMESPACE_USER.  The primary
distinction lies in the protection model: USER EAs are protected using the
normal inode protections, whereas SYSTEM EAs require privilege to access
or modify.

  Using UFS Extended Attributes

Support for UFS extended attributes is natively available in UFS2, and
requires no special configuration.  For reliability, administrative,
and performance reasons, if you plan to use extended attributes, it
is recommended that you use UFS2 in preference to UFS1.

Support for UFS extended attributes may be enabled for UFS1 by adding:

	options UFS_EXTATTR

to your kernel configuration file.  This allows UFS-based filesystems to
support extended attributes, but requires manual administration of EAs
using the extattrctl tool, including the starting of EA support for each
filesystem, and the enabling of individual attributes for the file
system.  The extattrctl utility may be used to initialize backing files
before first use, to start and stop EA service on a filesystem, and to
enable and disable named attributes.  The command lines for extattrctl
take the following forms:

  extattrctl start [path]
  extattrctl stop [path]
  extattrctl initattr [-f] [-p path] [attrsize] [attrfile]
  extattrctl enable [path] [attrnamespace] [attrname] [attrfile]
  extattrctl disable [path] [attrnamespace] [attrname]

In each case, [path] is used to indicate the mounted filesystem on which
to perform the operation.  [attrnamespace] refers to the namespace in
which the attribute is being manipulated, and may be "system" or "user".  
The [attrname] is the attribute name to use for the operation. The
[attrfile] argument specifies the attribute backing file to use. When
using the "initattr" function to initialize a backing file, the maximum
size of attribute data must be defined in bytes using the [attrsize]
field.  Optionally, the [-p path] argument may be used to indicate to
extattrctl that it should pre-allocate space for EA data, rather than
creating a sparse backing file.  This prevents attribute operations from
failing in low disk-space conditions (which can be important when EAs are
used for security purposes), but pre-allocation will consume space
proportional to the product of the defined maximum attribute size and
number of attributes on the specified filesystem.

Manual configuration increases administrative overhead, but also
introduces the possibility of race conditions during filesystem mount, if
EAs are used to support other features, as starting the EAs manually is
not atomic with the mount operation.  To address this problem, an
additional kernel option may be defined to auto-start EAs on a UFS file
system based on special directories at mount-time:

	options UFS_EXTATTR_AUTOSTART

If this option is defined, UFS will search for a ".attribute"
sub-directory of the filesystem root during the mount operation.  If it
is found, EA support will be started for the filesystem.  UFS will then
search for "system" and "user" sub-directories of the ".attribute"
directory for any potential backing files, and enable an EA for each valid
backing file with the name of the backing file as the attribute name.  
For example, by creating the following tree, the two EAs,
posix1e.acl_access and posix1e.acl_default will be enabled in the system
namespace of the root filesystem, reserving space for attribute data:

  mkdir -p /.attribute/system
  cd /.attribute/system
  extattrctl initattr -p / 388 posix1e.acl_access
  extattrctl initattr -p / 388 posix1e.acl_default

On the next mount of the root filesystem, the attributes will be
automatically started.