On Thu, Mar 27, 2025 at 11:23 AM Lionel Cons <lionelcons1...@gmail.com> wrote: > > On Thu, 27 Mar 2025 at 03:28, Rick Macklem <rick.mack...@gmail.com> wrote: > > > > On Wed, Mar 26, 2025 at 5:36 PM Andrew Walker <awal...@ixsystems.com> wrote: > > > > > > On Wed, Mar 26, 2025 at 5:05 PM Rick Macklem <rick.mack...@gmail.com> > > > wrote: > > > > I am now less convinced that a new value for xattr is needed. > > > > I need to do more testing, but with xattr set to dir and not sa > > > > (shown as "on" for zfs get xattr), the attributes seem compatible > > > > and it is just the KAPI which changes. > > > > > > > > rick > > > > > > Rick, is it OK to serve the same information as an xattr and as a > > > named attribute over NFS? > > Good question. I don't have the answer. It seems that it "will work", > > so so long as the "system attrnamespace" attributes cannot be > > accessed/created > > on the named attribute side, I don't se an obvious problem (see below). > > No, this is not intended to work that way. > > SUN plans with CITI's Windows driver was to implement Windows EA > (Extended Attributes) as "named attributes" (ref: > https://datatracker.ietf.org/doc/html/rfc5661#section-5.3) with a > prefix, e.g. EA attribute "abc" will have the ZFS/UFS/NFSv4 named > attribute named "windows.ea.abc". > Windows streams would also be prefixed, e.g. Windows stream "mystream" > would go into the name attribute "windows.stream.mystream". Well, right now ZFS has a function called zfs_check_attrname() to check for imbedded '/' characters and prefixes not allowed. The current list of prefixes is: "freebsd:" - Used by FreeBSD for system attrnamespace attributes "security." - Linux related, I think? "system." - Linux related? "trusted." - Linux related? "user." - Linux related?
So, except for the last one, the restricted prefixes are ones that are used by the associated system for privileged attributes. (The last one "user." is a Linux-ism that can optionally be prefixed to all names, but that seems to be disabled by default.) Note that RFC8276 specifies "user" attributes, so the above mostly applies to attributes set locally in ZFS by Linux or FreeBSD. Note also that the prefixes you are suggesting would currently be allowed. > > Prefixing is important to avoid namespace collisions. For example > Solaris has the "SUNWattr_" prefix for their internal stuff. IANA > created a registry called the "NFSv4 Named Attribute Definitions > Registry" to register these prefixes. Since only Solaris has implemented named attributes as far as I know, I suspect this IANA registry is largely forgotten. RFC5661 notes that there is no initial registry. I just looked and there does not appear to be any prefixes registered. > > Finally, Linux xattr and Windows EA are size-limited, Windows streams > and NFSv4 named attributes have unlimited size, and can even be sparse > (Google SEEK_HOLE about that). > > So if someone wants to implement Linux XATTR, then do it as SUN > intended, and create a "linux.xattr." prefix. Well, as I noted above, that is not what the Linux ZFS port does and I am not going to try and tell them it needs to change.;-) > > Lionel