diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2023-06-22 13:30:59 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2023-06-27 10:43:17 +0000 |
commit | 3bffa2262328e4ff1737516f176107f607e7bc76 (patch) | |
tree | 6b21cef2e91be80f0447dae62402249a570fae32 | |
parent | eb550615eff7f53dc4dfe523d455d276ce15d8b2 (diff) | |
download | src-3bffa2262328e4ff1737516f176107f607e7bc76.tar.gz src-3bffa2262328e4ff1737516f176107f607e7bc76.zip |
fdescfs: improve linrdlnk mount option
Instead of using VV_READLINK vnode flag and checking it in one place,
just assign VLNK type to the Fdesc vnodes for linrdlnk mounts. Then all
places where symlinks needs to be followed, e.g. lookup(), are handled.
PR: 272127
Reported by: Peter Eriksson <pen@lysator.liu.se>
Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D40700
-rw-r--r-- | sys/fs/fdescfs/fdesc_vnops.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 1c4b6d0c6cdb..3f6fca16c715 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -190,8 +190,9 @@ loop: fd->fd_type = ftype; fd->fd_fd = fd_fd; fd->fd_ix = ix; - if (ftype == Fdesc && fmp->flags & FMNT_LINRDLNKF) - vp->v_vflag |= VV_READLINK; + /* Cannot set v_type to VCHR */ + if (ftype == Fdesc && (fmp->flags & FMNT_LINRDLNKF) != 0) + vp->v_type = VLNK; error = insmntque1(vp, mp); if (error != 0) { vgone(vp); @@ -457,7 +458,8 @@ fdesc_getattr(struct vop_getattr_args *ap) break; case Fdesc: - vap->va_type = (vp->v_vflag & VV_READLINK) == 0 ? VCHR : VLNK; + vap->va_type = (VFSTOFDESC(vp->v_mount)->flags & + FMNT_LINRDLNKF) == 0 ? VCHR : VLNK; vap->va_nlink = 1; vap->va_size = 0; vap->va_rdev = makedev(0, vap->va_fileid); |