When a file lookup fails due to encountering a doomed vnode from a forced

unmount, consistently return ENOENT rather than EBADF.

Reviewed by:	kib
MFC after:	1 month
This commit is contained in:
John Baldwin 2009-03-24 18:16:42 +00:00
parent 6cad8eb41d
commit 049ce0934f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190387
2 changed files with 9 additions and 7 deletions

View File

@ -320,7 +320,7 @@ cache_zap(ncp)
* (negative cacheing), a status of ENOENT is returned. If the lookup
* fails, a status of zero is returned. If the directory vnode is
* recycled out from under us due to a forced unmount, a status of
* EBADF is returned.
* ENOENT is returned.
*
* vpp is locked and ref'd on return. If we're looking up DOTDOT, dvp is
* unlocked. If we're looking up . an extra ref is taken, but the lock is
@ -472,7 +472,7 @@ cache_lookup(dvp, vpp, cnp)
/* forced unmount */
vrele(*vpp);
*vpp = NULL;
return (EBADF);
return (ENOENT);
}
} else
vn_lock(*vpp, LK_DOWNGRADE | LK_RETRY);
@ -983,7 +983,7 @@ vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir,
if (vp->v_vflag & VV_ROOT) {
if (vp->v_iflag & VI_DOOMED) { /* forced unmount */
CACHE_RUNLOCK();
error = EBADF;
error = ENOENT;
break;
}
vp = vp->v_mount->mnt_vnodecovered;

View File

@ -602,7 +602,7 @@ lookup(struct nameidata *ndp)
if ((dp->v_vflag & VV_ROOT) == 0)
break;
if (dp->v_iflag & VI_DOOMED) { /* forced unmount */
error = EBADF;
error = ENOENT;
goto bad;
}
tdp = dp;
@ -764,9 +764,11 @@ lookup(struct nameidata *ndp)
*ndp->ni_next == '/')) {
cnp->cn_flags |= ISSYMLINK;
if (dp->v_iflag & VI_DOOMED) {
/* We can't know whether the directory was mounted with
* NOSYMFOLLOW, so we can't follow safely. */
error = EBADF;
/*
* We can't know whether the directory was mounted with
* NOSYMFOLLOW, so we can't follow safely.
*/
error = ENOENT;
goto bad2;
}
if (dp->v_mount->mnt_flag & MNT_NOSYMFOLLOW) {