diff options
| author | Rick Macklem <rmacklem@FreeBSD.org> | 2025-04-20 23:22:46 +0000 |
|---|---|---|
| committer | Rick Macklem <rmacklem@FreeBSD.org> | 2025-04-20 23:22:46 +0000 |
| commit | b1b607bd200fdd23724ec80738e55ad397bbe78f (patch) | |
| tree | d28b662217209490f09d3d22dee464cc88747dce | |
| parent | ee95e4d02dbdd59daed46bbf2170897c1c2a8894 (diff) | |
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")
| -rw-r--r-- | sys/kern/vfs_vnops.c | 19 |
1 files 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; |
