Extended and extra attributes
A file has two kinds of attribute beside its data and its permission bits. These are name–value pairs that an application writes for its own purposes, and a fixed set of flags that MooseFS keeps for its own. The Master Server holds both kinds, so both apply across the cluster rather than inside one mount.
What it is
Extended attributes (xattrs) are name–value pairs attached to an object in the namespace. MooseFS stores them and returns them. Only the program that wrote them defines what a name and a value mean. Backup tools, security frameworks, and applications keep their own records this way. Whoever writes extended attributes decides how many an object has and how large they are. Extended attributes are therefore the part of an object's metadata that grows with use.
Extra attributes (eattr) are a different thing under a similar name. They are a closed set of eight flags defined by MooseFS and included in every object. The flags change how MooseFS treats the object. They decide whether the object can be unlinked and whether the object can only be appended to. They also decide whose name the object appears under and what the client's kernel may cache about the object. Extended attributes are open-ended data that you store on an object. Extra attributes are a fixed list of switches that you set on that object. Patterns set and clear extra attributes. Only the application writes extended attributes.
Why it matters
Extended attributes let software that expects them work on MooseFS. They are also the only part of an object's metadata whose size you control. That size uses memory on the Master Server. Every extended attribute stays in that memory for as long as the object exists. A workload that puts many or large attributes on its files raises the amount of RAM that the Master Server needs. Count extended attributes when you size that machine (see Requirements for Master Servers). Extra attributes are not part of that calculation. They are a field of the object itself, eight flags wide whatever you set.
Extra attributes include protection that no mount can override. An object marked immutable, appendonly, or undeletable stays that way for every client, because the Master Server refuses the operation.
How MooseFS implements it
Extended attributes are part of the metadata that the Master Server holds, kept per object. Extra attributes are a field of the object's node. Both go into the metadata image and the changelog, so they remain after a restart of the Master Server.
A new object inherits extra attributes from the directory where the object is created. The three protective flags and the snapshot flag are never inherited, and an object other than a directory does not inherit noentrycache either. Taking a snapshot of an object copies its extended attributes along with the object.
The right to write either kind is set in two places. An export rule can forbid the clients it admits to set extended attributes or extra attributes. Only a session admitted with administrative privileges may set the three protective flags (see Session and export). A mount can turn extended attribute support off. For a short time, a mount also caches the attribute values that it has read. A change made through one mount is therefore not always visible at once through another mount.
MooseFS treats three name prefixes differently from the rest. A name in security. or trusted. is written by root alone. A name in trusted. is also read by root alone. A name in system. is written by root or by the object's owner, and by any user when the object has the noowner flag. Every other name follows the ordinary permission check on the object.
Root here is the identity that the session was admitted with, not the account on the client machine. An export entry that maps root to another user, through maproot or mapall, replaces uid 0 before the Master Server tests the name (access control). A gateway admitted through such an entry cannot write a name in security. at all, whichever account makes the call.
Defaults and limits
An extended attribute name is at most 255 bytes and its value at most 65536 bytes. The names on a single object come to at most 65536 bytes in total. The total includes a separator after each name. Extra attributes are a fixed set of eight flags.
Related terms
- Access Control Lists: permissions finer than owner, group, and other, kept by the same component.
- File locking: the third POSIX facility that a mount gets cluster-wide.
- POSIX compliance: the rest of what a mount gives a POSIX application.
- Master Server: the component that holds both kinds and answers about them.
- Metadata and namespace: the metadata they are part of.
- Client and mount: the side that asks, and where a mount option can narrow what is asked.
- Session and export: where the right to set them is granted or withheld.
- Patterns: rules that set extra attributes on objects as they are created.