diff options
author | njl <njl@FreeBSD.org> | 2002-09-14 09:02:28 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2002-09-14 09:02:28 +0000 |
commit | 0590c43070aac7fb636a1f4c4b94469046a317a0 (patch) | |
tree | e9205d0e4985af46af0db4bd26e9662b1c25f85b | |
parent | bb76739de046ae1f81a36e96d18f0ee3b1afd323 (diff) | |
download | FreeBSD-src-0590c43070aac7fb636a1f4c4b94469046a317a0.zip FreeBSD-src-0590c43070aac7fb636a1f4c4b94469046a317a0.tar.gz |
Remove all use of vnode->v_tag, replacing with appropriate substitutes.
v_tag is now const char * and should only be used for debugging.
Additionally:
1. All users of VT_NTS now check vfsconf->vf_type VFCF_NETWORK
2. The user of VT_PROCFS now checks for the new flag VV_PROCDEP, which
is propagated by pseudofs to all child vnodes if the fs sets PFS_PROCDEP.
Suggested by: phk
Reviewed by: bde, rwatson (earlier version)
55 files changed, 133 insertions, 125 deletions
diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index 719aed9..5416147 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -1959,7 +1959,7 @@ make_coda_node(fid, vfsp, type) lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); cp->c_fid = *fid; - err = getnewvnode(VT_CODA, vfsp, coda_vnodeop_p, &vp); + err = getnewvnode("coda", vfsp, coda_vnodeop_p, &vp); if (err) { panic("coda: getnewvnode returned error %d\n", err); } diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 2126238..4ec27d6 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -708,7 +708,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) return (0); /* Allocate a new vnode/iso_node. */ - if ((error = getnewvnode(VT_ISOFS, mp, cd9660_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("isofs", mp, cd9660_vnodeop_p, &vp)) != 0) { *vpp = NULLVP; return (error); } diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 91ecaa3..e0563e3 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -746,7 +746,7 @@ cd9660_print(ap) } */ *ap; { - printf("tag VT_ISOFS, isofs vnode\n"); + printf("tag %s, isofs vnode\n", ap->a_vp->v_tag); return (0); } diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index 719aed9..5416147 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -1959,7 +1959,7 @@ make_coda_node(fid, vfsp, type) lockinit(&cp->c_lock, PINOD, "cnode", 0, 0); cp->c_fid = *fid; - err = getnewvnode(VT_CODA, vfsp, coda_vnodeop_p, &vp); + err = getnewvnode("coda", vfsp, coda_vnodeop_p, &vp); if (err) { panic("coda: getnewvnode returned error %d\n", err); } diff --git a/sys/fs/deadfs/dead_vnops.c b/sys/fs/deadfs/dead_vnops.c index 6734ebe..3f70b90 100644 --- a/sys/fs/deadfs/dead_vnops.c +++ b/sys/fs/deadfs/dead_vnops.c @@ -248,7 +248,7 @@ dead_print(ap) } */ *ap; { - printf("tag VT_NON, dead vnode\n"); + printf("tag %s, dead vnode\n", ap->a_vp->v_tag); return (0); } diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 62a7b95..b181daa 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -144,7 +144,7 @@ loop: } else { dev = NODEV; } - error = getnewvnode(VT_DEVFS, mp, devfs_vnodeop_p, &vp); + error = getnewvnode("devfs", mp, devfs_vnodeop_p, &vp); if (error != 0) { printf("devfs_allocv: failed to allocate new vnode\n"); return (error); @@ -534,7 +534,7 @@ devfs_print(ap) } */ *ap; { - printf("tag VT_DEVFS, devfs vnode\n"); + printf("tag %s, devfs vnode\n", ap->a_vp->v_tag); return (0); } diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 5438024..b0b0e0d 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -135,7 +135,7 @@ loop: */ MALLOC(fd, struct fdescnode *, sizeof(struct fdescnode), M_TEMP, M_WAITOK); - error = getnewvnode(VT_FDESC, mp, fdesc_vnodeop_p, vpp); + error = getnewvnode("fdesc", mp, fdesc_vnodeop_p, vpp); if (error) { FREE(fd, M_TEMP); goto out; @@ -547,7 +547,7 @@ fdesc_print(ap) } */ *ap; { - printf("tag VT_NON, fdesc vnode\n"); + printf("tag %s, fdesc vnode\n", ap->a_vp->v_tag); return (0); } diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 7459223..ab3f8a1 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -564,7 +564,7 @@ fifo_print(ap) } */ *ap; { - printf("tag VT_NON"); + printf("tag %s", ap->a_vp->v_tag); fifo_printinfo(ap->a_vp); printf("\n"); return (0); diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index f4c808d..a85a2a2 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -496,7 +496,7 @@ hpfs_vget( MALLOC(hp, struct hpfsnode *, sizeof(struct hpfsnode), M_HPFSNO, M_WAITOK); - error = getnewvnode(VT_HPFS, hpmp->hpm_mp, hpfs_vnodeop_p, &vp); + error = getnewvnode("hpfs", hpmp->hpm_mp, hpfs_vnodeop_p, &vp); if (error) { printf("hpfs_vget: can't get new vnode\n"); FREE(hp, M_HPFSNO); diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c index c9d6379..316183e 100644 --- a/sys/fs/hpfs/hpfs_vnops.c +++ b/sys/fs/hpfs/hpfs_vnops.c @@ -659,7 +659,7 @@ hpfs_print(ap) register struct vnode *vp = ap->a_vp; register struct hpfsnode *hp = VTOHP(vp); - printf("tag VT_HPFS, ino 0x%x",hp->h_no); + printf("tag %s, ino 0x%x", vp->v_tag, hp->h_no); lockmgr_printinfo(&hp->h_lock); printf("\n"); return (0); diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 89d38fe..9b12552 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -253,7 +253,7 @@ deget(pmp, dirclust, diroffset, depp) * copy it from the passed disk buffer. */ /* getnewvnode() does a VREF() on the vnode */ - error = getnewvnode(VT_MSDOSFS, mntp, msdosfs_vnodeop_p, &nvp); + error = getnewvnode("msdosfs", mntp, msdosfs_vnodeop_p, &nvp); if (error) { *depp = NULL; FREE(ldep, M_MSDOSFSNODE); diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index a136190..bd3703d 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -648,7 +648,7 @@ msdosfs_unmount(mp, mntflags, td) TAILQ_FIRST(&vp->v_cleanblkhd), TAILQ_FIRST(&vp->v_dirtyblkhd), vp->v_numoutput, vp->v_type); - printf("union %p, tag %d, data[0] %08x, data[1] %08x\n", + printf("union %p, tag %s, data[0] %08x, data[1] %08x\n", vp->v_socket, vp->v_tag, ((u_int *)vp->v_data)[0], ((u_int *)vp->v_data)[1]); diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index 21e3f37..fdd5930 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1830,9 +1830,9 @@ msdosfs_print(ap) { struct denode *dep = VTODE(ap->a_vp); - printf( - "tag VT_MSDOSFS, startcluster %lu, dircluster %lu, diroffset %lu ", - dep->de_StartCluster, dep->de_dirclust, dep->de_diroffset); + printf("tag %s, startcluster %lu, dircluster %lu, diroffset %lu ", + ap->a_vp->v_tag, dep->de_StartCluster, + dep->de_dirclust, dep->de_diroffset); printf(" dev %d, %d", major(dep->de_dev), minor(dep->de_dev)); lockmgr_printinfo(&ap->a_vp->v_lock); printf("\n"); diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 99b18b4..1f3ba62 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -732,7 +732,7 @@ ntfs_vgetex( return (0); } - error = getnewvnode(VT_NTFS, ntmp->ntm_mountp, ntfs_vnodeop_p, &vp); + error = getnewvnode("ntfs", ntmp->ntm_mountp, ntfs_vnodeop_p, &vp); if(error) { ntfs_frele(fp); ntfs_ntput(ip); diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index 0de6c1f..fd8d9be 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -214,7 +214,7 @@ null_nodeget(mp, lowervp, vpp) MALLOC(xp, struct null_node *, sizeof(struct null_node), M_NULLFSNODE, M_WAITOK); - error = getnewvnode(VT_NULL, mp, null_vnodeop_p, &vp); + error = getnewvnode("null", mp, null_vnodeop_p, &vp); if (error) { FREE(xp, M_NULLFSNODE); return (error); diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 54bd884..5f46b2f 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -770,7 +770,8 @@ null_print(ap) } */ *ap; { register struct vnode *vp = ap->a_vp; - printf ("\ttag VT_NULLFS, vp=%p, lowervp=%p\n", vp, NULLVPTOLOWERVP(vp)); + printf("\ttag %s, vp=%p, lowervp=%p\n", vp->v_tag, vp, + NULLVPTOLOWERVP(vp)); return (0); } diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c index daf51e1..7a85d55 100644 --- a/sys/fs/nwfs/nwfs_node.c +++ b/sys/fs/nwfs/nwfs_node.c @@ -170,7 +170,7 @@ rescan: * elsewhere if MALLOC should block. */ MALLOC(np, struct nwnode *, sizeof *np, M_NWNODE, M_WAITOK | M_ZERO); - error = getnewvnode(VT_NWFS, mp, nwfs_vnodeop_p, &vp); + error = getnewvnode("nwfs", mp, nwfs_vnodeop_p, &vp); if (error) { *vpp = NULL; FREE(np, M_NWNODE); diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index 025721b..f66cbef 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -118,7 +118,7 @@ portal_mount(mp, path, data, ndp, td) MALLOC(fmp, struct portalmount *, sizeof(struct portalmount), M_PORTALFSMNT, M_WAITOK); /* XXX */ - error = getnewvnode(VT_PORTAL, mp, portal_vnodeop_p, &rvp); /* XXX */ + error = getnewvnode("portal", mp, portal_vnodeop_p, &rvp); /* XXX */ if (error) { FREE(fmp, M_PORTALFSMNT); FREE(pn, M_TEMP); diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c index 2d56232..97649d3 100644 --- a/sys/fs/portalfs/portal_vnops.c +++ b/sys/fs/portalfs/portal_vnops.c @@ -135,7 +135,7 @@ portal_lookup(ap) MALLOC(pt, struct portalnode *, sizeof(struct portalnode), M_TEMP, M_WAITOK); - error = getnewvnode(VT_PORTAL, dvp->v_mount, portal_vnodeop_p, &fvp); + error = getnewvnode("portal", dvp->v_mount, portal_vnodeop_p, &fvp); if (error) { FREE(pt, M_TEMP); goto bad; @@ -558,7 +558,7 @@ portal_print(ap) } */ *ap; { - printf("tag VT_PORTAL, portal vnode\n"); + printf("tag %s, portal vnode\n", ap->a_vp->v_tag); return (0); } diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c index a940012..8297ef6 100644 --- a/sys/fs/pseudofs/pseudofs.c +++ b/sys/fs/pseudofs/pseudofs.c @@ -75,6 +75,9 @@ _pfs_add_node(struct pfs_node *parent, struct pfs_node *node) node->pn_parent = parent; node->pn_next = parent->pn_nodes; parent->pn_nodes = node; + /* Propagate flag to all child nodes (and thus their vnodes) */ + if ((parent->pn_flags & PFS_PROCDEP) != 0) + node->pn_flags |= PFS_PROCDEP; mtx_unlock(&parent->pn_info->pi_mutex); return (0); @@ -129,7 +132,7 @@ pfs_create_dir(struct pfs_node *parent, char *name, dir->pn_type = (flags & PFS_PROCDEP) ? pfstype_procdir : pfstype_dir; dir->pn_attr = attr; dir->pn_vis = vis; - dir->pn_flags = flags & ~PFS_PROCDEP; + dir->pn_flags = flags; if (_pfs_add_node(parent, dir) != 0) { FREE(dir, M_PFSNODES); diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index 8d142e9..1239f12 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -135,7 +135,7 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp, MALLOC(pvd, struct pfs_vdata *, sizeof *pvd, M_PFSVNCACHE, M_WAITOK); if (++pfs_vncache_entries > pfs_vncache_maxentries) pfs_vncache_maxentries = pfs_vncache_entries; - error = getnewvnode(VT_PSEUDOFS, mp, pfs_vnodeop_p, vpp); + error = getnewvnode("pseudofs", mp, pfs_vnodeop_p, vpp); if (error) return (error); pvd->pvd_pn = pn; @@ -165,6 +165,12 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp, default: panic("%s has unexpected type: %d", pn->pn_name, pn->pn_type); } + /* + * Propagate flag through to vnode so users know it can change + * if the process changes (i.e. execve) + */ + if ((pn->pn_flags & PFS_PROCDEP) != 0) + (*vpp)->v_vflag |= VV_PROCDEP; pvd->pvd_vnode = *vpp; mtx_lock(&pfs_vncache_mutex); pvd->pvd_prev = NULL; diff --git a/sys/fs/smbfs/smbfs_node.c b/sys/fs/smbfs/smbfs_node.c index 4e79f78..33055a4 100644 --- a/sys/fs/smbfs/smbfs_node.c +++ b/sys/fs/smbfs/smbfs_node.c @@ -220,7 +220,7 @@ loop: return ENOENT; MALLOC(np, struct smbnode *, sizeof *np, M_SMBNODE, M_WAITOK); - error = getnewvnode(VT_SMBFS, mp, smbfs_vnodeop_p, &vp); + error = getnewvnode("smbfs", mp, smbfs_vnodeop_p, &vp); if (error) { FREE(np, M_SMBNODE); return error; diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index 219afbf..491b098 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -835,8 +835,8 @@ int smbfs_print (ap) printf("no smbnode data\n"); return (0); } - printf("tag VT_SMBFS, name = %s, parent = %p, opencount = %d", - np->n_name, np->n_parent ? SMBTOV(np->n_parent) : NULL, + printf("tag %s, name = %s, parent = %p, opencount = %d", + vp->v_tag, np->n_name, np->n_parent ? SMBTOV(np->n_parent) : NULL, np->n_opencount); lockmgr_printinfo(&vp->v_lock); printf("\n"); diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index 4fb3d5c..5ecc653 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -641,7 +641,8 @@ spec_print(ap) } */ *ap; { - printf("tag VT_NON, dev %s\n", devtoname(ap->a_vp->v_rdev)); + printf("tag %s, dev %s\n", ap->a_vp->v_tag, + devtoname(ap->a_vp->v_rdev)); return (0); } diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c index 3867eda..d752789 100644 --- a/sys/fs/udf/udf_vnops.c +++ b/sys/fs/udf/udf_vnops.c @@ -161,7 +161,7 @@ udf_allocv(struct mount *mp, struct vnode **vpp, struct thread *td) int error; struct vnode *vp; - error = getnewvnode(VT_UDF, mp, udf_vnodeop_p, &vp); + error = getnewvnode("udf", mp, udf_vnodeop_p, &vp); if (error) { printf("udf_allocv: failed to allocate new vnode\n"); return (error); diff --git a/sys/fs/umapfs/umap_subr.c b/sys/fs/umapfs/umap_subr.c index 02aec89..4be0eb1 100644 --- a/sys/fs/umapfs/umap_subr.c +++ b/sys/fs/umapfs/umap_subr.c @@ -212,7 +212,7 @@ umap_node_alloc(mp, lowervp, vpp) MALLOC(xp, struct umap_node *, sizeof(struct umap_node), M_TEMP, M_WAITOK); - error = getnewvnode(VT_UMAP, mp, umap_vnodeop_p, vpp); + error = getnewvnode("umap", mp, umap_vnodeop_p, vpp); if (error) { FREE(xp, M_TEMP); return (error); diff --git a/sys/fs/umapfs/umap_vnops.c b/sys/fs/umapfs/umap_vnops.c index 14abe0f..d0b385b 100644 --- a/sys/fs/umapfs/umap_vnops.c +++ b/sys/fs/umapfs/umap_vnops.c @@ -436,7 +436,8 @@ umap_print(ap) } */ *ap; { struct vnode *vp = ap->a_vp; - printf("\ttag VT_UMAPFS, vp=%p, lowervp=%p\n", vp, UMAPVPTOLOWERVP(vp)); + printf("\ttag %s, vp=%p, lowervp=%p\n", vp->v_tag, vp, + UMAPVPTOLOWERVP(vp)); return (0); } diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 66a4013..25094aa 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -443,7 +443,8 @@ loop: do { scan = VTOUNION(scan)->un_pvp; - } while (scan && scan->v_tag == VT_UNION && scan != dvp); + } while (scan && scan->v_op == union_vnodeop_p && + scan != dvp); if (scan != dvp) { /* * our new un is above dvp (we never saw dvp @@ -545,7 +546,7 @@ loop: * Create new node rather then replace old node */ - error = getnewvnode(VT_UNION, mp, union_vnodeop_p, vpp); + error = getnewvnode("union", mp, union_vnodeop_p, vpp); if (error) { /* * If an error occurs clear out vnodes. diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 227e817..92d92ed 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -1832,8 +1832,8 @@ union_print(ap) { struct vnode *vp = ap->a_vp; - printf("\ttag VT_UNION, vp=%p, uppervp=%p, lowervp=%p\n", - vp, UPPERVP(vp), LOWERVP(vp)); + printf("\ttag %s, vp=%p, uppervp=%p, lowervp=%p\n", vp->v_tag, + vp, UPPERVP(vp), LOWERVP(vp)); if (UPPERVP(vp) != NULLVP) vprint("union: upper", UPPERVP(vp)); if (LOWERVP(vp) != NULLVP) diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c index e77630c..788e2a7 100644 --- a/sys/gnu/ext2fs/ext2_vfsops.c +++ b/sys/gnu/ext2fs/ext2_vfsops.c @@ -1008,7 +1008,7 @@ restart: MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, M_WAITOK); /* Allocate a new vnode/inode. */ - if ((error = getnewvnode(VT_UFS, mp, ext2_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("ext2fs", mp, ext2_vnodeop_p, &vp)) != 0) { if (ext2fs_inode_hash_lock < 0) wakeup(&ext2fs_inode_hash_lock); ext2fs_inode_hash_lock = 0; diff --git a/sys/gnu/ext2fs/ext2_vnops.c b/sys/gnu/ext2fs/ext2_vnops.c index 22030b5..380638c 100644 --- a/sys/gnu/ext2fs/ext2_vnops.c +++ b/sys/gnu/ext2fs/ext2_vnops.c @@ -1557,9 +1557,9 @@ ext2_print(ap) struct vnode *vp = ap->a_vp; struct inode *ip = VTOI(vp); - printf("tag VT_UFS, ino %lu, on dev %s (%d, %d)", - (u_long)ip->i_number, devtoname(ip->i_dev), major(ip->i_dev), - minor(ip->i_dev)); + printf("tag %s, ino %lu, on dev %s (%d, %d)", + vp->v_tag, (u_long)ip->i_number, devtoname(ip->i_dev), + major(ip->i_dev), minor(ip->i_dev)); if (vp->v_type == VFIFO) fifo_printinfo(vp); lockmgr_printinfo(&vp->v_lock); diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index e77630c..788e2a7 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -1008,7 +1008,7 @@ restart: MALLOC(ip, struct inode *, sizeof(struct inode), M_EXT2NODE, M_WAITOK); /* Allocate a new vnode/inode. */ - if ((error = getnewvnode(VT_UFS, mp, ext2_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("ext2fs", mp, ext2_vnodeop_p, &vp)) != 0) { if (ext2fs_inode_hash_lock < 0) wakeup(&ext2fs_inode_hash_lock); ext2fs_inode_hash_lock = 0; diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c index 22030b5..380638c 100644 --- a/sys/gnu/fs/ext2fs/ext2_vnops.c +++ b/sys/gnu/fs/ext2fs/ext2_vnops.c @@ -1557,9 +1557,9 @@ ext2_print(ap) struct vnode *vp = ap->a_vp; struct inode *ip = VTOI(vp); - printf("tag VT_UFS, ino %lu, on dev %s (%d, %d)", - (u_long)ip->i_number, devtoname(ip->i_dev), major(ip->i_dev), - minor(ip->i_dev)); + printf("tag %s, ino %lu, on dev %s (%d, %d)", + vp->v_tag, (u_long)ip->i_number, devtoname(ip->i_dev), + major(ip->i_dev), minor(ip->i_dev)); if (vp->v_type == VFIFO) fifo_printinfo(vp); lockmgr_printinfo(&vp->v_lock); diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index 2126238..4ec27d6 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -708,7 +708,7 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) return (0); /* Allocate a new vnode/iso_node. */ - if ((error = getnewvnode(VT_ISOFS, mp, cd9660_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("isofs", mp, cd9660_vnodeop_p, &vp)) != 0) { *vpp = NULLVP; return (error); } diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index 91ecaa3..e0563e3 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -746,7 +746,7 @@ cd9660_print(ap) } */ *ap; { - printf("tag VT_ISOFS, isofs vnode\n"); + printf("tag %s, isofs vnode\n", ap->a_vp->v_tag); return (0); } diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index d88156b..9c091bd 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -53,6 +53,7 @@ #include <sys/kernel.h> #include <sys/sysctl.h> #include <sys/vnode.h> +#include <sys/mount.h> #include <sys/proc.h> #include <sys/namei.h> #include <sys/file.h> @@ -1407,11 +1408,8 @@ fdfree(td) /* * For setugid programs, we don't want to people to use that setugidness * to generate error messages which write to a file which otherwise would - * otherwise be off-limits to the process. - * - * This is a gross hack to plug the hole. A better solution would involve - * a special vop or other form of generalized access control mechanism. We - * go ahead and just reject all procfs filesystems accesses as dangerous. + * otherwise be off-limits to the process. We check for filesystems where + * the vnode can change out from under us after execve (like [lin]procfs). * * Since setugidsafety calls this only for fd 0, 1 and 2, this check is * sufficient. We also don't for check setugidness since we know we are. @@ -1419,9 +1417,12 @@ fdfree(td) static int is_unsafe(struct file *fp) { - if (fp->f_type == DTYPE_VNODE && - ((struct vnode *)(fp->f_data))->v_tag == VT_PROCFS) - return (1); + if (fp->f_type == DTYPE_VNODE) { + struct vnode *vp = (struct vnode *)fp->f_data; + + if ((vp->v_vflag & VV_PROCDEP) != 0) + return (1); + } return (0); } diff --git a/sys/kern/kern_mac.c b/sys/kern/kern_mac.c index 07d7b2d..5926f55 100644 --- a/sys/kern/kern_mac.c +++ b/sys/kern/kern_mac.c @@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred) return (0); */ /* printf("vn_refreshlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) + if (vp->v_type != VNON) printf( - "vn_refreshlabel: null v_mount with non-VT_NON\n"); + "vn_refreshlabel: null v_mount with non-VNON\n"); return (EBADF); } @@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred) if (vp->v_mount == NULL) { /* printf("vn_setlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) - printf("vn_setlabel: null v_mount with non-VT_NON\n"); + if (vp->v_type != VNON) + printf("vn_setlabel: null v_mount with non-VNON\n"); return (EBADF); } diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 8490644..a4e0397 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1211,7 +1211,8 @@ brelse(struct buf * bp) * background write. */ if ((bp->b_flags & B_VMIO) - && !(bp->b_vp->v_tag == VT_NFS && + && !(bp->b_vp->v_mount != NULL && + (bp->b_vp->v_mount->mnt_vfc->vfc_flags & VFCF_NETWORK) != 0 && !vn_isdisk(bp->b_vp, NULL) && (bp->b_flags & B_DELWRI)) ) { diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index b0be385..933a17f 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -792,7 +792,7 @@ done: */ int getnewvnode(tag, mp, vops, vpp) - enum vtagtype tag; + const char *tag; struct mount *mp; vop_t **vops; struct vnode **vpp; @@ -1591,14 +1591,16 @@ sched_sync(void) s = splbio(); if (LIST_FIRST(slp) == vp) { /* - * Note: v_tag VT_VFS vps can remain on the + * Note: VFS vnodes can remain on the * worklist too with no dirty blocks, but * since sync_fsync() moves it to a different * slot we are safe. */ if (TAILQ_EMPTY(&vp->v_dirtyblkhd) && - !vn_isdisk(vp, NULL)) - panic("sched_sync: fsync failed vp %p tag %d", vp, vp->v_tag); + !vn_isdisk(vp, NULL)) { + panic("sched_sync: fsync failed " + "vp %p tag %s", vp, vp->v_tag); + } /* * Put us back on the worklist. The worklist * routine will remove us from our current @@ -1812,7 +1814,7 @@ bdevvp(dev, vpp) } if (vfinddev(dev, VCHR, vpp)) return (0); - error = getnewvnode(VT_NON, (struct mount *)0, spec_vnodeop_p, &nvp); + error = getnewvnode("none", (struct mount *)0, spec_vnodeop_p, &nvp); if (error) { *vpp = NULLVP; return (error); @@ -2382,7 +2384,7 @@ vclean(vp, flags, td) vp->v_op = dead_vnodeop_p; if (vp->v_pollinfo != NULL) vn_pollgone(vp); - vp->v_tag = VT_NON; + vp->v_tag = "none"; vp->v_iflag &= ~VI_XLOCK; vp->v_vxproc = NULL; if (vp->v_iflag & VI_XWANT) { @@ -3190,7 +3192,7 @@ vfs_allocate_syncvnode(mp) int error; /* Allocate a new vnode */ - if ((error = getnewvnode(VT_VFS, mp, sync_vnodeop_p, &vp)) != 0) { + if ((error = getnewvnode("vfs", mp, sync_vnodeop_p, &vp)) != 0) { mp->mnt_syncer = NULL; return (error); } diff --git a/sys/nfsclient/nfs_node.c b/sys/nfsclient/nfs_node.c index 5dc0245..90ef7aa 100644 --- a/sys/nfsclient/nfs_node.c +++ b/sys/nfsclient/nfs_node.c @@ -223,7 +223,7 @@ loop: */ np = uma_zalloc(nfsnode_zone, M_WAITOK); - error = getnewvnode(VT_NFS, mntp, nfsv2_vnodeop_p, &nvp); + error = getnewvnode("nfs", mntp, nfsv2_vnodeop_p, &nvp); if (error) { if (nfs_node_hash_lock < 0) wakeup(&nfs_node_hash_lock); diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 66d142b..e55eb00 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -2863,8 +2863,8 @@ nfs_print(struct vop_print_args *ap) struct vnode *vp = ap->a_vp; struct nfsnode *np = VTONFS(vp); - printf("tag VT_NFS, fileid %ld fsid 0x%x", - np->n_vattr.va_fileid, np->n_vattr.va_fsid); + printf("tag %s fileid %ld fsid 0x%x", + vp->v_tag, np->n_vattr.va_fileid, np->n_vattr.va_fsid); if (vp->v_type == VFIFO) fifo_printinfo(vp); printf("\n"); diff --git a/sys/security/lomac/lomacfs_subr.c b/sys/security/lomac/lomacfs_subr.c index 10519da..6c1850d 100644 --- a/sys/security/lomac/lomacfs_subr.c +++ b/sys/security/lomac/lomacfs_subr.c @@ -73,7 +73,7 @@ lomacfs_node_alloc(struct mount *mp, struct componentname *cnp, return (EEXIST); } } - error = getnewvnode(VT_NULL, mp, lomacfs_vnodeop_p, vpp); + error = getnewvnode("lomacfs", mp, lomacfs_vnodeop_p, vpp); if (error) { vput(lowervp); free(lp, M_LOMACFS); diff --git a/sys/security/lomac/lomacfs_vnops.c b/sys/security/lomac/lomacfs_vnops.c index 9d98e69..cc9e4f9 100644 --- a/sys/security/lomac/lomacfs_vnops.c +++ b/sys/security/lomac/lomacfs_vnops.c @@ -175,7 +175,7 @@ lomacfs_print( ) { struct vnode *vp = ap->a_vp; - printf ("\ttag VT_LOMACFS, vp=%p, lowervp=%p\n", vp, + printf ("\ttag %s, vp=%p, lowervp=%p\n", vp->v_tag, vp, VTOLVP(vp)); return (0); } diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index 07d7b2d..5926f55 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred) return (0); */ /* printf("vn_refreshlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) + if (vp->v_type != VNON) printf( - "vn_refreshlabel: null v_mount with non-VT_NON\n"); + "vn_refreshlabel: null v_mount with non-VNON\n"); return (EBADF); } @@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred) if (vp->v_mount == NULL) { /* printf("vn_setlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) - printf("vn_setlabel: null v_mount with non-VT_NON\n"); + if (vp->v_type != VNON) + printf("vn_setlabel: null v_mount with non-VNON\n"); return (EBADF); } diff --git a/sys/security/mac/mac_internal.h b/sys/security/mac/mac_internal.h index 07d7b2d..5926f55 100644 --- a/sys/security/mac/mac_internal.h +++ b/sys/security/mac/mac_internal.h @@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred) return (0); */ /* printf("vn_refreshlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) + if (vp->v_type != VNON) printf( - "vn_refreshlabel: null v_mount with non-VT_NON\n"); + "vn_refreshlabel: null v_mount with non-VNON\n"); return (EBADF); } @@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred) if (vp->v_mount == NULL) { /* printf("vn_setlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) - printf("vn_setlabel: null v_mount with non-VT_NON\n"); + if (vp->v_type != VNON) + printf("vn_setlabel: null v_mount with non-VNON\n"); return (EBADF); } diff --git a/sys/security/mac/mac_net.c b/sys/security/mac/mac_net.c index 07d7b2d..5926f55 100644 --- a/sys/security/mac/mac_net.c +++ b/sys/security/mac/mac_net.c @@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred) return (0); */ /* printf("vn_refreshlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) + if (vp->v_type != VNON) printf( - "vn_refreshlabel: null v_mount with non-VT_NON\n"); + "vn_refreshlabel: null v_mount with non-VNON\n"); return (EBADF); } @@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred) if (vp->v_mount == NULL) { /* printf("vn_setlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) - printf("vn_setlabel: null v_mount with non-VT_NON\n"); + if (vp->v_type != VNON) + printf("vn_setlabel: null v_mount with non-VNON\n"); return (EBADF); } diff --git a/sys/security/mac/mac_pipe.c b/sys/security/mac/mac_pipe.c index 07d7b2d..5926f55 100644 --- a/sys/security/mac/mac_pipe.c +++ b/sys/security/mac/mac_pipe.c @@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred) return (0); */ /* printf("vn_refreshlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) + if (vp->v_type != VNON) printf( - "vn_refreshlabel: null v_mount with non-VT_NON\n"); + "vn_refreshlabel: null v_mount with non-VNON\n"); return (EBADF); } @@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred) if (vp->v_mount == NULL) { /* printf("vn_setlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) - printf("vn_setlabel: null v_mount with non-VT_NON\n"); + if (vp->v_type != VNON) + printf("vn_setlabel: null v_mount with non-VNON\n"); return (EBADF); } diff --git a/sys/security/mac/mac_process.c b/sys/security/mac/mac_process.c index 07d7b2d..5926f55 100644 --- a/sys/security/mac/mac_process.c +++ b/sys/security/mac/mac_process.c @@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred) return (0); */ /* printf("vn_refreshlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) + if (vp->v_type != VNON) printf( - "vn_refreshlabel: null v_mount with non-VT_NON\n"); + "vn_refreshlabel: null v_mount with non-VNON\n"); return (EBADF); } @@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred) if (vp->v_mount == NULL) { /* printf("vn_setlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) - printf("vn_setlabel: null v_mount with non-VT_NON\n"); + if (vp->v_type != VNON) + printf("vn_setlabel: null v_mount with non-VNON\n"); return (EBADF); } diff --git a/sys/security/mac/mac_syscalls.c b/sys/security/mac/mac_syscalls.c index 07d7b2d..5926f55 100644 --- a/sys/security/mac/mac_syscalls.c +++ b/sys/security/mac/mac_syscalls.c @@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred) return (0); */ /* printf("vn_refreshlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) + if (vp->v_type != VNON) printf( - "vn_refreshlabel: null v_mount with non-VT_NON\n"); + "vn_refreshlabel: null v_mount with non-VNON\n"); return (EBADF); } @@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred) if (vp->v_mount == NULL) { /* printf("vn_setlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) - printf("vn_setlabel: null v_mount with non-VT_NON\n"); + if (vp->v_type != VNON) + printf("vn_setlabel: null v_mount with non-VNON\n"); return (EBADF); } diff --git a/sys/security/mac/mac_system.c b/sys/security/mac/mac_system.c index 07d7b2d..5926f55 100644 --- a/sys/security/mac/mac_system.c +++ b/sys/security/mac/mac_system.c @@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred) return (0); */ /* printf("vn_refreshlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) + if (vp->v_type != VNON) printf( - "vn_refreshlabel: null v_mount with non-VT_NON\n"); + "vn_refreshlabel: null v_mount with non-VNON\n"); return (EBADF); } @@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred) if (vp->v_mount == NULL) { /* printf("vn_setlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) - printf("vn_setlabel: null v_mount with non-VT_NON\n"); + if (vp->v_type != VNON) + printf("vn_setlabel: null v_mount with non-VNON\n"); return (EBADF); } diff --git a/sys/security/mac/mac_vfs.c b/sys/security/mac/mac_vfs.c index 07d7b2d..5926f55 100644 --- a/sys/security/mac/mac_vfs.c +++ b/sys/security/mac/mac_vfs.c @@ -1116,9 +1116,9 @@ vn_refreshlabel(struct vnode *vp, struct ucred *cred) return (0); */ /* printf("vn_refreshlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) + if (vp->v_type != VNON) printf( - "vn_refreshlabel: null v_mount with non-VT_NON\n"); + "vn_refreshlabel: null v_mount with non-VNON\n"); return (EBADF); } @@ -2951,8 +2951,8 @@ vn_setlabel(struct vnode *vp, struct label *intlabel, struct ucred *cred) if (vp->v_mount == NULL) { /* printf("vn_setlabel: null v_mount\n"); */ - if (vp->v_tag != VT_NON) - printf("vn_setlabel: null v_mount with non-VT_NON\n"); + if (vp->v_type != VNON) + printf("vn_setlabel: null v_mount with non-VNON\n"); return (EBADF); } diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index b16ce9d..18d0e1a 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -65,18 +65,6 @@ enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD }; /* - * Vnode tag types. - * These are for the benefit of external programs only (e.g., pstat) - * and should NEVER be inspected by the kernel. - */ -enum vtagtype { - VT_NON, VT_UFS, VT_NFS, VT_UNUSED, VT_PC, VT_LFS, VT_LOFS, VT_FDESC, - VT_PORTAL, VT_NULL, VT_UMAP, VT_KERNFS, VT_PROCFS, VT_AFS, VT_ISOFS, - VT_UNION, VT_MSDOSFS, VT_DEVFS, VT_TFS, VT_VFS, VT_CODA, VT_NTFS, - VT_HPFS, VT_NWFS, VT_PSEUDOFS, VT_SMBFS, VT_UDF -}; - -/* * Each underlying filesystem allocates its own private area and hangs * it from v_data. If non-null, this area is freed in getnewvnode(). */ @@ -142,7 +130,7 @@ struct vnode { struct vm_object *v_object; /* Place to store VM object */ struct lock v_lock; /* used if fs don't have one */ struct lock *v_vnlock; /* pointer to vnode lock */ - enum vtagtype v_tag; /* type of underlying data */ + const char *v_tag; /* type of underlying data */ void *v_data; /* private data for fs */ LIST_HEAD(, namecache) v_cache_src; /* Cache entries from us */ TAILQ_HEAD(, namecache) v_cache_dst; /* Cache entries to us */ @@ -235,6 +223,7 @@ struct xvnode { #define VV_TEXT 0x0020 /* vnode is a pure text prototype */ #define VV_COPYONWRITE 0x0040 /* vnode is doing copy-on-write */ #define VV_SYSTEM 0x0080 /* vnode being used by kernel */ +#define VV_PROCDEP 0x0100 /* vnode is process dependent */ /* * Vnode attributes. A field value of VNOVAL represents a field whose value @@ -693,8 +682,8 @@ void cache_purgevfs(struct mount *mp); int cache_leaf_test(struct vnode *vp); void cvtstat(struct stat *st, struct ostat *ost); void cvtnstat(struct stat *sb, struct nstat *nsb); -int getnewvnode(enum vtagtype tag, - struct mount *mp, vop_t **vops, struct vnode **vpp); +int getnewvnode(const char *tag, struct mount *mp, vop_t **vops, + struct vnode **vpp); int lease_check(struct vop_lease_args *ap); int spec_vnoperate(struct vop_generic_args *); int speedup_syncer(void); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 5f87f32..9a9069b 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1215,7 +1215,7 @@ ffs_vget(mp, ino, flags, vpp) ump->um_malloctype, M_WAITOK); /* Allocate a new vnode/inode. */ - error = getnewvnode(VT_UFS, mp, ffs_vnodeop_p, &vp); + error = getnewvnode("ufs", mp, ffs_vnodeop_p, &vp); if (error) { *vpp = NULL; FREE(ip, ump->um_malloctype); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 93621bb..c048e54 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1979,9 +1979,9 @@ ufs_print(ap) struct vnode *vp = ap->a_vp; struct inode *ip = VTOI(vp); - printf("tag VT_UFS, ino %lu, on dev %s (%d, %d)", - (u_long)ip->i_number, devtoname(ip->i_dev), major(ip->i_dev), - minor(ip->i_dev)); + printf("tag %s, ino %lu, on dev %s (%d, %d)", + vp->v_tag, (u_long)ip->i_number, devtoname(ip->i_dev), + major(ip->i_dev), minor(ip->i_dev)); if (vp->v_type == VFIFO) fifo_printinfo(vp); lockmgr_printinfo(&vp->v_lock); diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index c12b532..80766e5 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -52,6 +52,7 @@ #include <sys/conf.h> #include <sys/stat.h> #include <sys/sysctl.h> +#include <sys/mount.h> #include <vm/vm.h> #include <vm/vm_extern.h> #include <vm/vm_param.h> @@ -222,7 +223,8 @@ swapon(td, uap) if (vn_isdisk(vp, &error)) error = swaponvp(td, vp, vp->v_rdev, 0); - else if (vp->v_type == VREG && vp->v_tag == VT_NFS && + else if (vp->v_type == VREG && + (vp->v_mount->mnt_vfc->vfc_flags & VFCF_NETWORK) != 0 && (error = VOP_GETATTR(vp, &attr, td->td_ucred, td)) == 0) { /* * Allow direct swapping to NFS regular files in the same @@ -265,7 +267,7 @@ swaponvp(td, vp, dev, nblks) u_long aligned_nblks; if (!swapdev_vp) { - error = getnewvnode(VT_NON, NULL, swapdev_vnodeop_p, + error = getnewvnode("none", NULL, swapdev_vnodeop_p, &swapdev_vp); if (error) panic("Cannot get vnode for swapdev"); |