ufs: handle two more cases of possible VNON vnode returned from VFS_VGET().

Reported by:	kevans
Reviewed by:	mckusick, mjg
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D27457
This commit is contained in:
Konstantin Belousov 2020-12-06 18:09:14 +00:00
parent 6e5a5dc03d
commit 2c7ada9917
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=368393
2 changed files with 7 additions and 0 deletions

View file

@ -745,6 +745,11 @@ ufs_lookup_ino(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp,
*vpp = vdp;
} else {
error = VFS_VGET(pdp->v_mount, ino, cnp->cn_lkflags, &tdp);
if (error == 0 && VTOI(tdp)->i_mode == 0) {
vgone(tdp);
vput(tdp);
error = ENOENT;
}
if (error)
return (error);
*vpp = tdp;

View file

@ -240,6 +240,8 @@ ufs_fhtovp(mp, ufhp, flags, vpp)
ip = VTOI(nvp);
if (ip->i_mode == 0 || ip->i_gen != ufhp->ufid_gen ||
ip->i_effnlink <= 0) {
if (ip->i_mode == 0)
vgone(nvp);
vput(nvp);
*vpp = NULLVP;
return (ESTALE);