vfs_vnops.c: Make O_NAMEDATTR Solaris compatible

When the O_XATTR flag is used in a Solaris open(2),
the named attribute directory is created, if it does
not already exist. (Solaris does not require or allow
O_CREAT for this case.)

The consensus on the mailing list was that O_NAMEDATTR
should behave the same way, as in "create the named
attribute directory if it does not exist even if O_CREAT
is not specified.

This patch makes this change. Note that CREATENAMED is
still useful for the NFSv4 server.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D50139
Fixes:	2ec2ba7e23 ("vfs: Add VFS/syscall support for Solaris style extended attributes")
This commit is contained in:
Rick Macklem 2025-05-04 14:58:56 -07:00
parent 9639de2a6f
commit f61844833e

View file

@ -208,11 +208,8 @@ open2nameif(int fmode, u_int vn_open_flags)
res |= OPENREAD;
if ((fmode & FWRITE) != 0)
res |= OPENWRITE;
if ((fmode & O_NAMEDATTR) != 0) {
res |= OPENNAMED;
if ((fmode & O_CREAT) != 0)
res |= CREATENAMED;
}
if ((fmode & O_NAMEDATTR) != 0)
res |= OPENNAMED | CREATENAMED;
if ((vn_open_flags & VN_OPEN_NOAUDIT) == 0)
res |= AUDITVNODE1;
if ((vn_open_flags & VN_OPEN_NOCAPCHECK) != 0)