diff options
author | jhb <jhb@FreeBSD.org> | 2009-03-24 18:16:42 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-03-24 18:16:42 +0000 |
commit | 503529db8f3ec06fa2c4c153add021fab16d6292 (patch) | |
tree | ed618950d79f562475694cba001e93d3e1c1fcc4 /sys | |
parent | ac5c4c1c38ac2250cf5494d03b2f00b165f14f02 (diff) | |
download | FreeBSD-src-503529db8f3ec06fa2c4c153add021fab16d6292.zip FreeBSD-src-503529db8f3ec06fa2c4c153add021fab16d6292.tar.gz |
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
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_cache.c | 6 | ||||
-rw-r--r-- | sys/kern/vfs_lookup.c | 10 |
2 files changed, 9 insertions, 7 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 0d506bc..77cf2c4 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -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 @@ success: /* 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; diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index daecd6f..77c2e42 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -602,7 +602,7 @@ dirloop: 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 @@ unionlookup: *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) { |