aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs/ffs
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-01-28 12:20:48 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-02-12 01:02:20 +0000
commit89fd61d955ada4fdb20030253206201bc279cdf0 (patch)
treeb0a18c56861d033346d4a0e58a382079179f1bc9 /sys/ufs/ffs
parent5952c86c78b177b5e904bf139e6b56519897c7e0 (diff)
downloadsrc-89fd61d955ada4fdb20030253206201bc279cdf0.tar.gz
src-89fd61d955ada4fdb20030253206201bc279cdf0.zip
Merge ufs_fhtovp() into ffs_inotovp().
The function alone was not used for anything but ffs_fstovp() for long time. Suggested by: mckusick Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 596e2f4b4b5f..540dd02c9631 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -2170,6 +2170,7 @@ ffs_inotovp(mp, ino, gen, lflags, vpp, ffs_flags)
{
struct ufsmount *ump;
struct vnode *nvp;
+ struct inode *ip;
struct fs *fs;
struct cg *cgp;
struct buf *bp;
@@ -2178,6 +2179,8 @@ ffs_inotovp(mp, ino, gen, lflags, vpp, ffs_flags)
ump = VFSTOUFS(mp);
fs = ump->um_fs;
+ *vpp = NULL;
+
if (ino < UFS_ROOTINO || ino >= fs->fs_ncg * fs->fs_ipg)
return (ESTALE);
@@ -2198,10 +2201,20 @@ ffs_inotovp(mp, ino, gen, lflags, vpp, ffs_flags)
}
error = ffs_vgetf(mp, ino, lflags, &nvp, ffs_flags);
- if (error == 0)
- error = ufs_fhtovp(mp, nvp, gen);
- *vpp = error == 0 ? nvp : NULLVP;
- return (error);
+ if (error != 0)
+ return (error);
+
+ ip = VTOI(nvp);
+ if (ip->i_mode == 0 || ip->i_gen != gen || ip->i_effnlink <= 0) {
+ if (ip->i_mode == 0)
+ vgone(nvp);
+ vput(nvp);
+ return (ESTALE);
+ }
+
+ vnode_create_vobject(nvp, DIP(ip, i_size), curthread);
+ *vpp = nvp;
+ return (0);
}
/*