From b9b0a6d05cf8d3fdabaadab7076af97ab2f154ea Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 22 Jul 2009 22:00:13 -0700 Subject: [PATCH] HAMMER / VFS_VGET - Add optional dvp argument to VFS_VGET(). Fix readdirplus * VGET is used by NFS to acquire a vnode given an inode number. HAMMER requires additional information to determine the PFS the inode is being acquired from. Add an optional directory vnode argument to the VGET. If non-NULL, HAMMER will extract the PFS information from this vnode. * Adjust NFS to pass the dvp to VGET when doing a readdirplus. Note that the PFS is already encoded in file handles, but readdirplus acquires the attributes for each directory entry it scans (readdir does not). This fixes readdirplus for NFS served HAMMER PFS exports. --- sys/kern/vfs_default.c | 2 +- sys/sys/mount.h | 5 +++-- sys/vfs/gnu/ext2fs/ext2_alloc.c | 2 +- sys/vfs/gnu/ext2fs/ext2_lookup.c | 10 +++++----- sys/vfs/gnu/ext2fs/ext2_vfsops.c | 8 ++++---- sys/vfs/gnu/ext2fs/ext2_vnops.c | 2 +- sys/vfs/hammer/hammer_vfsops.c | 26 ++++++++++++++++++++------ sys/vfs/hpfs/hpfs_subr.c | 6 +++--- sys/vfs/hpfs/hpfs_vfsops.c | 10 +++++----- sys/vfs/hpfs/hpfs_vnops.c | 4 ++-- sys/vfs/isofs/cd9660/cd9660_vfsops.c | 6 +++--- sys/vfs/nfs/nfs_serv.c | 4 ++-- sys/vfs/ntfs/ntfs_subr.c | 2 +- sys/vfs/ntfs/ntfs_vfsops.c | 16 +++++++++------- sys/vfs/ntfs/ntfs_vnops.c | 2 +- sys/vfs/udf/udf.h | 2 +- sys/vfs/udf/udf_vfsops.c | 6 +++--- sys/vfs/udf/udf_vnops.c | 2 +- sys/vfs/ufs/ffs_alloc.c | 2 +- sys/vfs/ufs/ffs_extern.h | 2 +- sys/vfs/ufs/ffs_softdep.c | 11 ++++++----- sys/vfs/ufs/ffs_vfsops.c | 2 +- sys/vfs/ufs/ufs_lookup.c | 11 ++++++----- sys/vfs/ufs/ufs_vfsops.c | 4 ++-- sys/vfs/ufs/ufs_vnops.c | 2 +- sys/vfs/userfs/userfs.h | 3 ++- sys/vfs/userfs/userfs_inode.c | 3 ++- 27 files changed, 88 insertions(+), 67 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 70ccdb54ce..1f23f23e73 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1404,7 +1404,7 @@ vfs_stdnosync(struct mount *mp, int waitfor) } int -vfs_stdvget(struct mount *mp, ino_t ino, struct vnode **vpp) +vfs_stdvget(struct mount *mp, struct vnode *dvp, ino_t ino, struct vnode **vpp) { return (EOPNOTSUPP); } diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 4abe131cc6..208b25dd5b 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -429,7 +429,8 @@ typedef int vfs_statfs_t(struct mount *mp, struct statfs *sbp, typedef int vfs_statvfs_t(struct mount *mp, struct statvfs *sbp, struct ucred *cred); typedef int vfs_sync_t(struct mount *mp, int waitfor); -typedef int vfs_vget_t(struct mount *mp, ino_t ino, struct vnode **vpp); +typedef int vfs_vget_t(struct mount *mp, struct vnode *dvp, + ino_t ino, struct vnode **vpp); typedef int vfs_fhtovp_t(struct mount *mp, struct vnode *rootvp, struct fid *fhp, struct vnode **vpp); typedef int vfs_checkexp_t(struct mount *mp, struct sockaddr *nam, @@ -468,7 +469,7 @@ struct vfsops { #define VFS_STATFS(MP, SBP, CRED) (*(MP)->mnt_op->vfs_statfs)(MP, SBP, CRED) #define VFS_STATVFS(MP, SBP, CRED) (*(MP)->mnt_op->vfs_statvfs)(MP, SBP, CRED) #define VFS_SYNC(MP, WAIT) (*(MP)->mnt_op->vfs_sync)(MP, WAIT) -#define VFS_VGET(MP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP) +#define VFS_VGET(MP, DVP, INO, VPP) (*(MP)->mnt_op->vfs_vget)(MP, DVP, INO, VPP) #define VFS_FHTOVP(MP, ROOTVP, FIDP, VPP) \ (*(MP)->mnt_op->vfs_fhtovp)(MP, ROOTVP, FIDP, VPP) #define VFS_VPTOFH(VP, FIDP) (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP) diff --git a/sys/vfs/gnu/ext2fs/ext2_alloc.c b/sys/vfs/gnu/ext2fs/ext2_alloc.c index 3b25788f91..4e6eec8708 100644 --- a/sys/vfs/gnu/ext2fs/ext2_alloc.c +++ b/sys/vfs/gnu/ext2fs/ext2_alloc.c @@ -392,7 +392,7 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp) if (ino == 0) goto noinodes; - error = VFS_VGET(pvp->v_mount, ino, vpp); + error = VFS_VGET(pvp->v_mount, NULL, ino, vpp); if (error) { EXT2_VFREE(pvp, ino, mode); return (error); diff --git a/sys/vfs/gnu/ext2fs/ext2_lookup.c b/sys/vfs/gnu/ext2fs/ext2_lookup.c index 8f081d4938..e1b72d16aa 100644 --- a/sys/vfs/gnu/ext2fs/ext2_lookup.c +++ b/sys/vfs/gnu/ext2fs/ext2_lookup.c @@ -583,7 +583,7 @@ found: *vpp = vdp; return (0); } - if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) != 0) + if ((error = VFS_VGET(vdp->v_mount, NULL, dp->i_ino, &tdp)) != 0) return (error); /* * If directory is "sticky", then user must own @@ -619,7 +619,7 @@ found: */ if (dp->i_number == dp->i_ino) return (EISDIR); - if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) != 0) + if ((error = VFS_VGET(vdp->v_mount, NULL, dp->i_ino, &tdp)) != 0) return (error); *vpp = tdp; if (!lockparent) @@ -649,7 +649,7 @@ found: pdp = vdp; if (flags & CNP_ISDOTDOT) { vn_unlock(pdp); /* race to get the inode */ - if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) != 0) { + if ((error = VFS_VGET(vdp->v_mount, NULL, dp->i_ino, &tdp)) != 0) { vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY); return (error); } @@ -662,7 +662,7 @@ found: vref(vdp); /* we want ourself, ie "." */ *vpp = vdp; } else { - if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) != 0) + if ((error = VFS_VGET(vdp->v_mount, NULL, dp->i_ino, &tdp)) != 0) return (error); if (!lockparent) vn_unlock(pdp); @@ -1032,7 +1032,7 @@ ext2_checkpath(struct inode *source, struct inode *target, struct ucred *cred) if (dirbuf.dotdot_ino == rootino) break; vput(vp); - if ((error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, &vp)) != 0) { + if ((error = VFS_VGET(vp->v_mount, NULL, dirbuf.dotdot_ino, &vp)) != 0) { vp = NULL; break; } diff --git a/sys/vfs/gnu/ext2fs/ext2_vfsops.c b/sys/vfs/gnu/ext2fs/ext2_vfsops.c index 7657238553..082a50dd84 100644 --- a/sys/vfs/gnu/ext2fs/ext2_vfsops.c +++ b/sys/vfs/gnu/ext2fs/ext2_vfsops.c @@ -87,7 +87,7 @@ static int ext2_sbupdate (struct ext2mount *, int); static int ext2_statfs (struct mount *, struct statfs *, struct ucred *); static int ext2_sync (struct mount *, int); static int ext2_unmount (struct mount *, int); -static int ext2_vget (struct mount *, ino_t, struct vnode **); +static int ext2_vget (struct mount *, struct vnode *, ino_t, struct vnode **); static int ext2_init(struct vfsconf *); static int ext2_vptofh (struct vnode *, struct fid *); @@ -127,7 +127,7 @@ ext2_root(struct mount *mp, struct vnode **vpp) struct vnode *nvp; int error; - error = VFS_VGET(mp, (ino_t)ROOTINO, &nvp); + error = VFS_VGET(mp, NULL, (ino_t)ROOTINO, &nvp); if (error) return (error); *vpp = nvp; @@ -1099,7 +1099,7 @@ ext2_sync_scan(struct mount *mp, struct vnode *vp, void *data) * done by the calling routine. */ static int -ext2_vget(struct mount *mp, ino_t ino, struct vnode **vpp) +ext2_vget(struct mount *mp, struct vnode *dvp, ino_t ino, struct vnode **vpp) { struct ext2_sb_info *fs; struct inode *ip; @@ -1267,7 +1267,7 @@ ext2_fhtovp(struct mount *mp, struct vnode *rootvp, ufhp->ufid_ino > fs->s_groups_count * fs->s_es->s_inodes_per_group) return (ESTALE); - error = VFS_VGET(mp, ufhp->ufid_ino, &nvp); + error = VFS_VGET(mp, rootvp, ufhp->ufid_ino, &nvp); if (error) { *vpp = NULLVP; return (error); diff --git a/sys/vfs/gnu/ext2fs/ext2_vnops.c b/sys/vfs/gnu/ext2fs/ext2_vnops.c index 3baa61c6ae..79d6f0ece9 100644 --- a/sys/vfs/gnu/ext2fs/ext2_vnops.c +++ b/sys/vfs/gnu/ext2fs/ext2_vnops.c @@ -311,7 +311,7 @@ ext2_mknod(struct vop_old_mknod_args *ap) ino = ip->i_number; /* Save this before vgone() invalidates ip. */ vgone_vxlocked(*vpp); vput(*vpp); - error = VFS_VGET(ap->a_dvp->v_mount, ino, vpp); + error = VFS_VGET(ap->a_dvp->v_mount, NULL, ino, vpp); if (error) { *vpp = NULL; return (error); diff --git a/sys/vfs/hammer/hammer_vfsops.c b/sys/vfs/hammer/hammer_vfsops.c index de76d376b6..ebcd0bedc1 100644 --- a/sys/vfs/hammer/hammer_vfsops.c +++ b/sys/vfs/hammer/hammer_vfsops.c @@ -230,8 +230,8 @@ static int hammer_vfs_statfs(struct mount *mp, struct statfs *sbp, static int hammer_vfs_statvfs(struct mount *mp, struct statvfs *sbp, struct ucred *cred); static int hammer_vfs_sync(struct mount *mp, int waitfor); -static int hammer_vfs_vget(struct mount *mp, ino_t ino, - struct vnode **vpp); +static int hammer_vfs_vget(struct mount *mp, struct vnode *dvp, + ino_t ino, struct vnode **vpp); static int hammer_vfs_init(struct vfsconf *conf); static int hammer_vfs_fhtovp(struct mount *mp, struct vnode *rootvp, struct fid *fhp, struct vnode **vpp); @@ -627,7 +627,7 @@ hammer_vfs_mount(struct mount *mp, char *mntpt, caddr_t data, * FUTURE: Leave the root directory cached referenced but unlocked * in hmp->rootvp (need to flush it on unmount). */ - error = hammer_vfs_vget(mp, 1, &rootvp); + error = hammer_vfs_vget(mp, NULL, 1, &rootvp); if (error) goto done; vput(rootvp); @@ -785,22 +785,36 @@ hammer_critical_error(hammer_mount_t hmp, hammer_inode_t ip, * vnode is returned. */ int -hammer_vfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) +hammer_vfs_vget(struct mount *mp, struct vnode *dvp, + ino_t ino, struct vnode **vpp) { struct hammer_transaction trans; struct hammer_mount *hmp = (void *)mp->mnt_data; struct hammer_inode *ip; int error; + u_int32_t localization; hammer_simple_transaction(&trans, hmp); + /* + * If a directory vnode is supplied (mainly NFS) then we can acquire + * the PFS domain from it. Otherwise we would only be able to vget + * inodes in the root PFS. + */ + if (dvp) { + localization = HAMMER_DEF_LOCALIZATION + + VTOI(dvp)->obj_localization; + } else { + localization = HAMMER_DEF_LOCALIZATION; + } + /* * Lookup the requested HAMMER inode. The structure must be * left unlocked while we manipulate the related vnode to avoid * a deadlock. */ ip = hammer_get_inode(&trans, NULL, ino, - hmp->asof, HAMMER_DEF_LOCALIZATION, + hmp->asof, localization, 0, &error); if (ip == NULL) { *vpp = NULL; @@ -827,7 +841,7 @@ hammer_vfs_root(struct mount *mp, struct vnode **vpp) #endif int error; - error = hammer_vfs_vget(mp, 1, vpp); + error = hammer_vfs_vget(mp, NULL, 1, vpp); return (error); } diff --git a/sys/vfs/hpfs/hpfs_subr.c b/sys/vfs/hpfs/hpfs_subr.c index 1c87a2b1c5..2180703eb2 100644 --- a/sys/vfs/hpfs/hpfs_subr.c +++ b/sys/vfs/hpfs/hpfs_subr.c @@ -537,7 +537,7 @@ hpfs_validateparent ( if (hp->h_no == hp->h_fn.fn_parent) { dhp = hp; } else { - error = VFS_VGET(hpmp->hpm_mp, hp->h_fn.fn_parent, &dvp); + error = VFS_VGET(hpmp->hpm_mp, NULL, hp->h_fn.fn_parent, &dvp); if (error) return (error); dhp = VTOHP(dvp); @@ -689,8 +689,8 @@ hpfs_updateparent ( if (hp->h_no == hp->h_fn.fn_parent) { dhp = hp; } else { - error = VFS_VGET(hp->h_hpmp->hpm_mp, hp->h_fn.fn_parent, - &dvp); + error = VFS_VGET(hp->h_hpmp->hpm_mp, NULL, + hp->h_fn.fn_parent, &dvp); if (error) return (error); dhp = VTOHP(dvp); diff --git a/sys/vfs/hpfs/hpfs_vfsops.c b/sys/vfs/hpfs/hpfs_vfsops.c index f720d1fee1..87b7ea3707 100644 --- a/sys/vfs/hpfs/hpfs_vfsops.c +++ b/sys/vfs/hpfs/hpfs_vfsops.c @@ -68,8 +68,8 @@ MALLOC_DEFINE(M_HPFSNO, "HPFS node", "HPFS node structure"); static int hpfs_root (struct mount *, struct vnode **); static int hpfs_statfs (struct mount *, struct statfs *, struct ucred *); static int hpfs_unmount (struct mount *, int); -static int hpfs_vget (struct mount *mp, ino_t ino, - struct vnode **vpp); +static int hpfs_vget (struct mount *mp, struct vnode *, + ino_t ino, struct vnode **vpp); static int hpfs_mountfs (struct vnode *, struct mount *, struct hpfs_args *); static int hpfs_vptofh (struct vnode *, struct fid *); @@ -383,7 +383,7 @@ hpfs_root(struct mount *mp, struct vnode **vpp) struct hpfsmount *hpmp = VFSTOHPFS(mp); dprintf(("hpfs_root():\n")); - error = VFS_VGET(mp, (ino_t)hpmp->hpm_su.su_rootfno, vpp); + error = VFS_VGET(mp, NULL, (ino_t)hpmp->hpm_su.su_rootfno, vpp); if(error) { kprintf("hpfs_root: VFS_VGET failed: %d\n",error); return (error); @@ -426,7 +426,7 @@ hpfs_fhtovp(struct mount *mp, struct vnode *rootvp, struct hpfid *hpfhp = (struct hpfid *)fhp; int error; - if ((error = VFS_VGET(mp, hpfhp->hpfid_ino, &nvp)) != 0) { + if ((error = VFS_VGET(mp, NULL, hpfhp->hpfid_ino, &nvp)) != 0) { *vpp = NULLVP; return (error); } @@ -452,7 +452,7 @@ hpfs_vptofh(struct vnode *vp, struct fid *fhp) } static int -hpfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) +hpfs_vget(struct mount *mp, struct vnode *dvp, ino_t ino, struct vnode **vpp) { struct hpfsmount *hpmp = VFSTOHPFS(mp); struct vnode *vp; diff --git a/sys/vfs/hpfs/hpfs_vnops.c b/sys/vfs/hpfs/hpfs_vnops.c index 3c60bd8343..ea88ca53f7 100644 --- a/sys/vfs/hpfs/hpfs_vnops.c +++ b/sys/vfs/hpfs/hpfs_vnops.c @@ -1051,7 +1051,7 @@ hpfs_lookup(struct vop_old_lookup_args *ap) VOP__UNLOCK(dvp, 0); - error = VFS_VGET(hpmp->hpm_mp, + error = VFS_VGET(hpmp->hpm_mp, NULL, dhp->h_fn.fn_parent, ap->a_vpp); if (error) { VOP__LOCK(dvp, 0); @@ -1099,7 +1099,7 @@ hpfs_lookup(struct vop_old_lookup_args *ap) return (0); } - error = VFS_VGET(hpmp->hpm_mp, dep->de_fnode, ap->a_vpp); + error = VFS_VGET(hpmp->hpm_mp, NULL, dep->de_fnode, ap->a_vpp); if (error) { kprintf("hpfs_lookup: VFS_VGET FAILED %d\n", error); brelse(bp); diff --git a/sys/vfs/isofs/cd9660/cd9660_vfsops.c b/sys/vfs/isofs/cd9660/cd9660_vfsops.c index c38e0383fa..6a4fe12ee1 100644 --- a/sys/vfs/isofs/cd9660/cd9660_vfsops.c +++ b/sys/vfs/isofs/cd9660/cd9660_vfsops.c @@ -74,7 +74,7 @@ static int cd9660_mount (struct mount *, char *, caddr_t, struct ucred *); static int cd9660_unmount (struct mount *, int); static int cd9660_root (struct mount *, struct vnode **); static int cd9660_statfs (struct mount *, struct statfs *, struct ucred *); -static int cd9660_vget (struct mount *, ino_t, struct vnode **); +static int cd9660_vget (struct mount *, struct vnode *, ino_t, struct vnode **); static int cd9660_fhtovp (struct mount *, struct vnode *rootvp, struct fid *, struct vnode **); static int cd9660_checkexp (struct mount *, struct sockaddr *, @@ -631,7 +631,7 @@ cd9660_fhtovp(struct mount *mp, struct vnode *rootvp, ifhp->ifid_ino, ifhp->ifid_start); #endif - if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) { + if ((error = VFS_VGET(mp, NULL, ifhp->ifid_ino, &nvp)) != 0) { *vpp = NULLVP; return (error); } @@ -667,7 +667,7 @@ cd9660_checkexp(struct mount *mp, struct sockaddr *nam, int *exflagsp, } int -cd9660_vget(struct mount *mp, ino_t ino, struct vnode **vpp) +cd9660_vget(struct mount *mp, struct vnode *dvp, ino_t ino, struct vnode **vpp) { /* diff --git a/sys/vfs/nfs/nfs_serv.c b/sys/vfs/nfs/nfs_serv.c index 021240b262..b0709d6eea 100644 --- a/sys/vfs/nfs/nfs_serv.c +++ b/sys/vfs/nfs/nfs_serv.c @@ -3347,7 +3347,7 @@ again: * Probe one of the directory entries to see if the filesystem * supports VGET. */ - if (VFS_VGET(vp->v_mount, dp->d_ino, &nvp) == EOPNOTSUPP) { + if (VFS_VGET(vp->v_mount, vp, dp->d_ino, &nvp) == EOPNOTSUPP) { error = NFSERR_NOTSUPP; vrele(vp); vp = NULL; @@ -3384,7 +3384,7 @@ again: * For readdir_and_lookup get the vnode using * the file number. */ - if (VFS_VGET(vp->v_mount, dp->d_ino, &nvp)) + if (VFS_VGET(vp->v_mount, vp, dp->d_ino, &nvp)) goto invalid; bzero((caddr_t)nfhp, NFSX_V3FH); nfhp->fh_fsid = fhp->fh_fsid; diff --git a/sys/vfs/ntfs/ntfs_subr.c b/sys/vfs/ntfs/ntfs_subr.c index 05cbe2aab0..44a26a95ca 100644 --- a/sys/vfs/ntfs/ntfs_subr.c +++ b/sys/vfs/ntfs/ntfs_subr.c @@ -1866,7 +1866,7 @@ ntfs_toupper_use(struct mount *mp, struct ntfsmount *ntmp) MALLOC(ntfs_toupper_tab, wchar *, 65536 * sizeof(wchar), M_NTFSRDATA, M_WAITOK); - if ((error = VFS_VGET(mp, NTFS_UPCASEINO, &vp))) + if ((error = VFS_VGET(mp, NULL, NTFS_UPCASEINO, &vp))) goto out; error = ntfs_readattr(ntmp, VTONT(vp), NTFS_A_DATA, NULL, 0, 65536*sizeof(wchar), (char *) ntfs_toupper_tab, NULL); diff --git a/sys/vfs/ntfs/ntfs_vfsops.c b/sys/vfs/ntfs/ntfs_vfsops.c index a09be209e9..259c65110f 100644 --- a/sys/vfs/ntfs/ntfs_vfsops.c +++ b/sys/vfs/ntfs/ntfs_vfsops.c @@ -82,9 +82,10 @@ MALLOC_DEFINE(M_NTFSDIR,"NTFS dir", "NTFS dir buffer"); static int ntfs_root (struct mount *, struct vnode **); static int ntfs_statfs (struct mount *, struct statfs *, struct ucred *cred); static int ntfs_unmount (struct mount *, int); -static int ntfs_vget (struct mount *mp, ino_t ino, struct vnode **vpp); +static int ntfs_vget (struct mount *mp, struct vnode *dvp, + ino_t ino, struct vnode **vpp); static int ntfs_mountfs (struct vnode *, struct mount *, - struct ntfs_args *, struct ucred *); + struct ntfs_args *, struct ucred *); static int ntfs_vptofh (struct vnode *, struct fid *); static int ntfs_fhtovp (struct mount *, struct vnode *rootvp, struct fid *, struct vnode **); @@ -494,7 +495,8 @@ ntfs_mountfs(struct vnode *devvp, struct mount *mp, struct ntfs_args *argsp, { int pi[3] = { NTFS_MFTINO, NTFS_ROOTINO, NTFS_BITMAPINO }; for (i=0; i<3; i++) { - error = VFS_VGET(mp, pi[i], &(ntmp->ntm_sysvn[pi[i]])); + error = VFS_VGET(mp, NULL, + pi[i], &(ntmp->ntm_sysvn[pi[i]])); if(error) goto out1; ntmp->ntm_sysvn[pi[i]]->v_flag |= VSYSTEM; @@ -524,7 +526,7 @@ ntfs_mountfs(struct vnode *devvp, struct mount *mp, struct ntfs_args *argsp, struct attrdef ad; /* Open $AttrDef */ - error = VFS_VGET(mp, NTFS_ATTRDEFINO, &vp); + error = VFS_VGET(mp, NULL, NTFS_ATTRDEFINO, &vp); if(error) goto out1; @@ -680,7 +682,7 @@ ntfs_root(struct mount *mp, struct vnode **vpp) dprintf(("ntfs_root(): sysvn: %p\n", VFSTONTFS(mp)->ntm_sysvn[NTFS_ROOTINO])); - error = VFS_VGET(mp, (ino_t)NTFS_ROOTINO, &nvp); + error = VFS_VGET(mp, NULL, (ino_t)NTFS_ROOTINO, &nvp); if(error) { kprintf("ntfs_root: VFS_VGET failed: %d\n",error); return (error); @@ -787,7 +789,7 @@ ntfs_fhtovp(struct mount *mp, struct vnode *rootvp, ddprintf(("ntfs_fhtovp(): %d\n", ntfhp->ntfid_ino)); - if ((error = VFS_VGET(mp, ntfhp->ntfid_ino, &nvp)) != 0) { + if ((error = VFS_VGET(mp, NULL, ntfhp->ntfid_ino, &nvp)) != 0) { *vpp = NULLVP; return (error); } @@ -918,7 +920,7 @@ ntfs_vgetex(struct mount *mp, ino_t ino, u_int32_t attrtype, char *attrname, } static int -ntfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) +ntfs_vget(struct mount *mp, struct vnode *dvp, ino_t ino, struct vnode **vpp) { return ntfs_vgetex(mp, ino, NTFS_A_DATA, NULL, LK_EXCLUSIVE | LK_RETRY, 0, curthread, vpp); diff --git a/sys/vfs/ntfs/ntfs_vnops.c b/sys/vfs/ntfs/ntfs_vnops.c index af1a2d1b25..f067aa7340 100644 --- a/sys/vfs/ntfs/ntfs_vnops.c +++ b/sys/vfs/ntfs/ntfs_vnops.c @@ -714,7 +714,7 @@ ntfs_lookup(struct vop_old_lookup_args *ap) dprintf(("ntfs_lookup: parentdir: %d\n", vap->va_a_name->n_pnumber)); - error = VFS_VGET(ntmp->ntm_mountp, + error = VFS_VGET(ntmp->ntm_mountp, NULL, vap->va_a_name->n_pnumber,ap->a_vpp); ntfs_ntvattrrele(vap); if (error) { diff --git a/sys/vfs/udf/udf.h b/sys/vfs/udf/udf.h index ee6338af3c..d7f71d0ece 100644 --- a/sys/vfs/udf/udf.h +++ b/sys/vfs/udf/udf.h @@ -131,4 +131,4 @@ int udf_hashlookup(struct udf_mnt *, ino_t, struct vnode **); int udf_hashins(struct udf_node *); int udf_hashrem(struct udf_node *); int udf_checktag(struct desc_tag *, uint16_t); -int udf_vget(struct mount *, ino_t, struct vnode **); +int udf_vget(struct mount *, struct vnode *, ino_t, struct vnode **); diff --git a/sys/vfs/udf/udf_vfsops.c b/sys/vfs/udf/udf_vfsops.c index a36021b5e8..b6e195b5de 100644 --- a/sys/vfs/udf/udf_vfsops.c +++ b/sys/vfs/udf/udf_vfsops.c @@ -441,7 +441,7 @@ udf_root(struct mount *mp, struct vnode **vpp) id = udf_getid(&udfmp->root_icb); - error = udf_vget(mp, id, vpp); + error = udf_vget(mp, NULL, id, vpp); if (error) return(error); @@ -475,7 +475,7 @@ udf_statfs(struct mount *mp, struct statfs *sbp, struct ucred *cred) } int -udf_vget(struct mount *mp, ino_t ino, struct vnode **vpp) +udf_vget(struct mount *mp, struct vnode *dvp, ino_t ino, struct vnode **vpp) { struct buf *bp; struct vnode *devvp; @@ -594,7 +594,7 @@ udf_fhtovp(struct mount *mp, struct vnode *rootvp, ifhp = (struct ifid *)fhp; - if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) { + if ((error = VFS_VGET(mp, NULL, ifhp->ifid_ino, &nvp)) != 0) { *vpp = NULLVP; return(error); } diff --git a/sys/vfs/udf/udf_vnops.c b/sys/vfs/udf/udf_vnops.c index dc9e49cdbf..aa88021dbb 100644 --- a/sys/vfs/udf/udf_vnops.c +++ b/sys/vfs/udf/udf_vnops.c @@ -1002,7 +1002,7 @@ lookloop: /* Did we have a match? */ if (id) { - error = udf_vget(udfmp->im_mountp, id, &tdp); + error = udf_vget(udfmp->im_mountp, NULL, id, &tdp); if (!error) { /* * Remember where this entry was if it's the final diff --git a/sys/vfs/ufs/ffs_alloc.c b/sys/vfs/ufs/ffs_alloc.c index ecdf044792..3e83219866 100644 --- a/sys/vfs/ufs/ffs_alloc.c +++ b/sys/vfs/ufs/ffs_alloc.c @@ -614,7 +614,7 @@ ffs_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp) (allocfcn_t *)ffs_nodealloccg); if (ino == 0) goto noinodes; - error = VFS_VGET(pvp->v_mount, ino, vpp); + error = VFS_VGET(pvp->v_mount, NULL, ino, vpp); if (error) { ffs_vfree(pvp, ino, mode); return (error); diff --git a/sys/vfs/ufs/ffs_extern.h b/sys/vfs/ufs/ffs_extern.h index 2eccc5e1cc..d05b4ecd84 100644 --- a/sys/vfs/ufs/ffs_extern.h +++ b/sys/vfs/ufs/ffs_extern.h @@ -100,7 +100,7 @@ int ffs_update(struct vnode *, int); int ffs_valloc(struct vnode *, int, struct ucred *, struct vnode **); int ffs_vfree(struct vnode *, ino_t, int); -int ffs_vget(struct mount *, ino_t, struct vnode **); +int ffs_vget(struct mount *, struct vnode *, ino_t, struct vnode **); int ffs_vptofh(struct vnode *, struct fid *); /* diff --git a/sys/vfs/ufs/ffs_softdep.c b/sys/vfs/ufs/ffs_softdep.c index 370819b7b1..6a4dbe69f5 100644 --- a/sys/vfs/ufs/ffs_softdep.c +++ b/sys/vfs/ufs/ffs_softdep.c @@ -2933,7 +2933,8 @@ handle_workitem_remove(struct dirrem *dirrem) ino_t oldinum; int error; - if ((error = VFS_VGET(dirrem->dm_mnt, dirrem->dm_oldinum, &vp)) != 0) { + error = VFS_VGET(dirrem->dm_mnt, NULL, dirrem->dm_oldinum, &vp); + if (error) { softdep_error("handle_workitem_remove: vget", error); return; } @@ -4171,7 +4172,7 @@ softdep_fsync(struct vnode *vp) */ FREE_LOCK(&lk); vn_unlock(vp); - error = VFS_VGET(mnt, parentino, &pvp); + error = VFS_VGET(mnt, NULL, parentino, &pvp); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (error != 0) return (error); @@ -4690,7 +4691,7 @@ flush_pagedep_deps(struct vnode *pvp, struct mount *mp, inum = dap->da_newinum; if (dap->da_state & MKDIR_BODY) { FREE_LOCK(&lk); - if ((error = VFS_VGET(mp, inum, &vp)) != 0) + if ((error = VFS_VGET(mp, NULL, inum, &vp)) != 0) break; if ((error=VOP_FSYNC(vp, MNT_NOWAIT)) || (error=VOP_FSYNC(vp, MNT_NOWAIT))) { @@ -4904,7 +4905,7 @@ clear_remove(struct thread *td) mp = pagedep->pd_mnt; ino = pagedep->pd_ino; FREE_LOCK(&lk); - if ((error = VFS_VGET(mp, ino, &vp)) != 0) { + if ((error = VFS_VGET(mp, NULL, ino, &vp)) != 0) { softdep_error("clear_remove: vget", error); return; } @@ -4992,7 +4993,7 @@ clear_inodedeps(struct thread *td) if (inodedep_lookup(fs, ino, 0, &inodedep) == 0) continue; FREE_LOCK(&lk); - if ((error = VFS_VGET(info.mp, ino, &vp)) != 0) { + if ((error = VFS_VGET(info.mp, NULL, ino, &vp)) != 0) { softdep_error("clear_inodedeps: vget", error); return; } diff --git a/sys/vfs/ufs/ffs_vfsops.c b/sys/vfs/ufs/ffs_vfsops.c index cfffa4f889..d1072c87b4 100644 --- a/sys/vfs/ufs/ffs_vfsops.c +++ b/sys/vfs/ufs/ffs_vfsops.c @@ -1070,7 +1070,7 @@ ffs_sync_scan2(struct mount *mp, struct vnode *vp, void *data) */ int -ffs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) +ffs_vget(struct mount *mp, struct vnode *dvp, ino_t ino, struct vnode **vpp) { struct fs *fs; struct inode *ip; diff --git a/sys/vfs/ufs/ufs_lookup.c b/sys/vfs/ufs/ufs_lookup.c index 39d4b15019..a6bbafea0d 100644 --- a/sys/vfs/ufs/ufs_lookup.c +++ b/sys/vfs/ufs/ufs_lookup.c @@ -485,7 +485,7 @@ found: } if (flags & CNP_ISDOTDOT) vn_unlock(vdp); /* race to get the inode */ - error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp); + error = VFS_VGET(vdp->v_mount, NULL, dp->i_ino, &tdp); if (flags & CNP_ISDOTDOT) { if (vn_lock(vdp, LK_EXCLUSIVE | LK_RETRY) != 0) cnp->cn_flags |= CNP_PDIRUNLOCK; @@ -530,7 +530,7 @@ found: return (EISDIR); if (flags & CNP_ISDOTDOT) vn_unlock(vdp); /* race to get the inode */ - error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp); + error = VFS_VGET(vdp->v_mount, NULL, dp->i_ino, &tdp); if (flags & CNP_ISDOTDOT) { if (vn_lock(vdp, LK_EXCLUSIVE | LK_RETRY) != 0) cnp->cn_flags |= CNP_PDIRUNLOCK; @@ -568,7 +568,8 @@ found: if (flags & CNP_ISDOTDOT) { vn_unlock(pdp); /* race to get the inode */ cnp->cn_flags |= CNP_PDIRUNLOCK; - if ((error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp)) != 0) { + error = VFS_VGET(vdp->v_mount, NULL, dp->i_ino, &tdp); + if (error) { if (vn_lock(pdp, LK_EXCLUSIVE | LK_RETRY) == 0) cnp->cn_flags &= ~CNP_PDIRUNLOCK; return (error); @@ -585,7 +586,7 @@ found: vref(vdp); /* we want ourself, ie "." */ *vpp = vdp; } else { - error = VFS_VGET(vdp->v_mount, dp->i_ino, &tdp); + error = VFS_VGET(vdp->v_mount, NULL, dp->i_ino, &tdp); if (error) return (error); if (!lockparent) { @@ -1156,7 +1157,7 @@ ufs_checkpath(struct inode *source, struct inode *target, struct ucred *cred) if (dirbuf.dotdot_ino == rootino) break; vput(vp); - error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino, &vp); + error = VFS_VGET(vp->v_mount, NULL, dirbuf.dotdot_ino, &vp); if (error) { vp = NULL; break; diff --git a/sys/vfs/ufs/ufs_vfsops.c b/sys/vfs/ufs/ufs_vfsops.c index 803f6bc571..bf1ef5256f 100644 --- a/sys/vfs/ufs/ufs_vfsops.c +++ b/sys/vfs/ufs/ufs_vfsops.c @@ -65,7 +65,7 @@ ufs_root(struct mount *mp, struct vnode **vpp) struct vnode *nvp; int error; - error = VFS_VGET(mp, (ino_t)ROOTINO, &nvp); + error = VFS_VGET(mp, NULL, (ino_t)ROOTINO, &nvp); if (error) return (error); *vpp = nvp; @@ -213,7 +213,7 @@ ufs_fhtovp(struct mount *mp, struct vnode *rootpv, struct vnode *nvp; int error; - error = VFS_VGET(mp, ufhp->ufid_ino, &nvp); + error = VFS_VGET(mp, NULL, ufhp->ufid_ino, &nvp); if (error) { *vpp = NULLVP; return (error); diff --git a/sys/vfs/ufs/ufs_vnops.c b/sys/vfs/ufs/ufs_vnops.c index 98b08923ba..58d94ff0f5 100644 --- a/sys/vfs/ufs/ufs_vnops.c +++ b/sys/vfs/ufs/ufs_vnops.c @@ -257,7 +257,7 @@ ufs_mknod(struct vop_old_mknod_args *ap) ino = ip->i_number; /* Save this before vgone() invalidates ip. */ vgone_vxlocked(*vpp); vput(*vpp); - error = VFS_VGET(ap->a_dvp->v_mount, ino, vpp); + error = VFS_VGET(ap->a_dvp->v_mount, NULL, ino, vpp); if (error) { *vpp = NULL; return (error); diff --git a/sys/vfs/userfs/userfs.h b/sys/vfs/userfs/userfs.h index a649e29d07..d90f2eed37 100644 --- a/sys/vfs/userfs/userfs.h +++ b/sys/vfs/userfs/userfs.h @@ -90,7 +90,8 @@ struct user_inode { extern struct vop_ops userfs_vnode_vops; int user_vop_inactive(struct vop_inactive_args *); int user_vop_reclaim(struct vop_reclaim_args *); -int user_vfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp); +int user_vfs_vget(struct mount *mp, struct vnode *dvp, + ino_t ino, struct vnode **vpp); void user_elm_push_vnode(syslink_elm_t par, struct vnode *vp); void user_elm_push_offset(syslink_elm_t par, off_t offset); diff --git a/sys/vfs/userfs/userfs_inode.c b/sys/vfs/userfs/userfs_inode.c index 507b07c84d..fc879e7870 100644 --- a/sys/vfs/userfs/userfs_inode.c +++ b/sys/vfs/userfs/userfs_inode.c @@ -73,7 +73,8 @@ user_vop_reclaim(struct vop_reclaim_args *ap) } int -user_vfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp) +user_vfs_vget(struct mount *mp, struct vnode *dvp, + ino_t ino, struct vnode **vpp) { struct user_mount *ump = (void *)mp->mnt_data; struct user_inode *ip; -- 2.41.0