The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9c3bfe2ad07170cd7d3645a7c24f4d80a509c2b7

commit 9c3bfe2ad07170cd7d3645a7c24f4d80a509c2b7
Author:     Konstantin Belousov <k...@freebsd.org>
AuthorDate: 2023-07-11 04:58:06 +0000
Commit:     Konstantin Belousov <k...@freebsd.org>
CommitDate: 2023-07-13 01:14:12 +0000

    Revert "VFS: Remove VV_READLINK flag" and "fdescfs: improve linrdlnk mount 
option"
    
    This reverts commits 4a402dfe0bc44770c9eac6e58a501e4805e29413 and
    3bffa2262328e4ff1737516f176107f607e7bc76.
    
    The fix will be implemented in somewhat different manner.  The semantic
    adjustment is incompatible with linuxolator expectations.
    
    Reported and reviewed by:       dchagin
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D40969
---
 sys/fs/fdescfs/fdesc_vnops.c | 8 +++-----
 sys/kern/vfs_subr.c          | 4 +++-
 sys/kern/vfs_syscalls.c      | 2 +-
 sys/sys/vnode.h              | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c
index 3f6fca16c715..1c4b6d0c6cdb 100644
--- a/sys/fs/fdescfs/fdesc_vnops.c
+++ b/sys/fs/fdescfs/fdesc_vnops.c
@@ -190,9 +190,8 @@ loop:
        fd->fd_type = ftype;
        fd->fd_fd = fd_fd;
        fd->fd_ix = ix;
-       /* Cannot set v_type to VCHR */
-       if (ftype == Fdesc && (fmp->flags & FMNT_LINRDLNKF) != 0)
-               vp->v_type = VLNK;
+       if (ftype == Fdesc && fmp->flags & FMNT_LINRDLNKF)
+               vp->v_vflag |= VV_READLINK;
        error = insmntque1(vp, mp);
        if (error != 0) {
                vgone(vp);
@@ -458,8 +457,7 @@ fdesc_getattr(struct vop_getattr_args *ap)
                break;
 
        case Fdesc:
-               vap->va_type = (VFSTOFDESC(vp->v_mount)->flags &
-                   FMNT_LINRDLNKF) == 0 ? VCHR : VLNK;
+               vap->va_type = (vp->v_vflag & VV_READLINK) == 0 ? VCHR : VLNK;
                vap->va_nlink = 1;
                vap->va_size = 0;
                vap->va_rdev = makedev(0, vap->va_fileid);
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index b7d43863a228..25efabf3acc7 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -4284,9 +4284,11 @@ vn_printf(struct vnode *vp, const char *fmt, ...)
                strlcat(buf, "|VV_MD", sizeof(buf));
        if (vp->v_vflag & VV_FORCEINSMQ)
                strlcat(buf, "|VV_FORCEINSMQ", sizeof(buf));
+       if (vp->v_vflag & VV_READLINK)
+               strlcat(buf, "|VV_READLINK", sizeof(buf));
        flags = vp->v_vflag & ~(VV_ROOT | VV_ISTTY | VV_NOSYNC | VV_ETERNALDEV |
            VV_CACHEDLABEL | VV_VMSIZEVNLOCK | VV_COPYONWRITE | VV_SYSTEM |
-           VV_PROCDEP | VV_DELETED | VV_MD | VV_FORCEINSMQ);
+           VV_PROCDEP | VV_DELETED | VV_MD | VV_FORCEINSMQ | VV_READLINK);
        if (flags != 0) {
                snprintf(buf2, sizeof(buf2), "|VV(0x%lx)", flags);
                strlcat(buf, buf2, sizeof(buf));
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 52145ece7120..d68af4ea4d51 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -2677,7 +2677,7 @@ kern_readlink_vp(struct vnode *vp, char *buf, enum 
uio_seg bufseg, size_t count,
        if (error != 0)
                return (error);
 #endif
-       if (vp->v_type != VLNK)
+       if (vp->v_type != VLNK && (vp->v_vflag & VV_READLINK) == 0)
                return (EINVAL);
 
        aiov.iov_base = buf;
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index e7ebc39ada1d..d8fd580facb5 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -270,7 +270,7 @@ _Static_assert(sizeof(struct vnode) <= 448, "vnode size 
crosses 448 bytes");
 #define        VV_DELETED      0x0400  /* should be removed */
 #define        VV_MD           0x0800  /* vnode backs the md device */
 #define        VV_FORCEINSMQ   0x1000  /* force the insmntque to succeed */
-#define        VV_UNUSED01     0x2000  /* was: fdescfs linux vnode */
+#define        VV_READLINK     0x2000  /* fdescfs linux vnode */
 #define        VV_UNREF        0x4000  /* vunref, do not drop lock in 
inactive() */
 #define        VV_CROSSLOCK    0x8000  /* vnode lock is shared w/ root mounted 
here */
 

Reply via email to