Revert "VFS: Remove VV_READLINK flag" and "fdescfs: improve linrdlnk mount option"

This reverts commits 4a402dfe0b and
3bffa22623.

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
This commit is contained in:
Konstantin Belousov 2023-07-11 07:58:06 +03:00
parent 510fd83138
commit 9c3bfe2ad0
4 changed files with 8 additions and 8 deletions

View File

@ -190,9 +190,8 @@ fdesc_allocvp(fdntype ftype, unsigned fd_fd, int ix, struct mount *mp,
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);

View File

@ -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));

View File

@ -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;

View File

@ -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 */