git: b1b607bd200f - main - vfs_vnops.c: Modify the O_NAMEDATTR check for Solaris compatibility
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Apr 2025 23:24:01 UTC
The branch main has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=b1b607bd200fdd23724ec80738e55ad397bbe78f
commit b1b607bd200fdd23724ec80738e55ad397bbe78f
Author: Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2025-04-20 23:22:46 +0000
Commit: Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2025-04-20 23:22:46 +0000
vfs_vnops.c: Modify the O_NAMEDATTR check for Solaris compatibility
The Solaris semantics for their O_XATTR flag is to use it
for a file object in the file system's namespace to indicate
that a named attribute for the file object should be open'd.
To do this, the O_NAMEDATTR flag must be allowed with a
non-named attribute directory. This patch changes vfs_vnops_cred()
to allow this.
This patch fixes 2ec2ba7e232d so that Solaris compatible
semantics can be implemented by patched ZFS code.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D49899
Fixes: 2ec2ba7e232d ("vfs: Add VFS/syscall support for Solaris style extended attributes")
---
sys/kern/vfs_vnops.c | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 6ad9c75564c3..f1d3ba2ac08b 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -285,18 +285,13 @@ restart:
if ((error = namei(ndp)) != 0)
return (error);
if (ndp->ni_vp == NULL) {
- if ((fmode & O_NAMEDATTR) != 0) {
- if ((ndp->ni_dvp->v_mount->mnt_flag &
- MNT_NAMEDATTR) == 0)
- error = EINVAL;
- else if ((vn_irflag_read(ndp->ni_dvp) &
- VIRF_NAMEDDIR) == 0)
- error = ENOENT;
- if (error != 0) {
- vp = ndp->ni_dvp;
- ndp->ni_dvp = NULL;
- goto bad;
- }
+ if ((fmode & O_NAMEDATTR) != 0 &&
+ (ndp->ni_dvp->v_mount->mnt_flag & MNT_NAMEDATTR) ==
+ 0) {
+ error = EINVAL;
+ vp = ndp->ni_dvp;
+ ndp->ni_dvp = NULL;
+ goto bad;
}
VATTR_NULL(vap);
vap->va_type = VREG;