From owner-svn-src-head@FreeBSD.ORG Tue Mar 24 18:16:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75C411065725; Tue, 24 Mar 2009 18:16:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 499DA8FC1F; Tue, 24 Mar 2009 18:16:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2OIGhIl053314; Tue, 24 Mar 2009 18:16:43 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2OIGhHj053312; Tue, 24 Mar 2009 18:16:43 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903241816.n2OIGhHj053312@svn.freebsd.org> From: John Baldwin Date: Tue, 24 Mar 2009 18:16:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190387 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Mar 2009 18:16:45 -0000 Author: jhb Date: Tue Mar 24 18:16:42 2009 New Revision: 190387 URL: http://svn.freebsd.org/changeset/base/190387 Log: 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 Modified: head/sys/kern/vfs_cache.c head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Tue Mar 24 18:10:22 2009 (r190386) +++ head/sys/kern/vfs_cache.c Tue Mar 24 18:16:42 2009 (r190387) @@ -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 v 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; Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Tue Mar 24 18:10:22 2009 (r190386) +++ head/sys/kern/vfs_lookup.c Tue Mar 24 18:16:42 2009 (r190387) @@ -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) {