From owner-svn-src-stable@FreeBSD.ORG Sun Feb 22 10:17:11 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B20A106568C; Sun, 22 Feb 2009 10:17:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBC228FC0C; Sun, 22 Feb 2009 10:17:10 +0000 (UTC) (envelope-from kib@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 n1MAHAci090152; Sun, 22 Feb 2009 10:17:10 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1MAHAiC090149; Sun, 22 Feb 2009 10:17:10 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200902221017.n1MAHAiC090149@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 22 Feb 2009 10:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188910 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern sys ufs/ufs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Feb 2009 10:17:12 -0000 Author: kib Date: Sun Feb 22 10:17:10 2009 New Revision: 188910 URL: http://svn.freebsd.org/changeset/base/188910 Log: MFC r187528: Move the code from ufs_lookup.c used to do dotdot lookup, into the helper function. It is supposed to be useful for any filesystem that has to unlock dvp to walk to the ".." entry in lookup routine. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/vfs_vnops.c stable/7/sys/sys/vnode.h stable/7/sys/ufs/ufs/ufs_lookup.c Modified: stable/7/sys/kern/vfs_vnops.c ============================================================================== --- stable/7/sys/kern/vfs_vnops.c Sun Feb 22 03:02:46 2009 (r188909) +++ stable/7/sys/kern/vfs_vnops.c Sun Feb 22 10:17:10 2009 (r188910) @@ -1221,3 +1221,35 @@ vn_extattr_rm(struct vnode *vp, int iofl return (error); } + +int +vn_vget_ino(struct vnode *vp, ino_t ino, int lkflags, struct vnode **rvp) +{ + struct mount *mp; + int ltype, error; + + mp = vp->v_mount; + ltype = VOP_ISLOCKED(vp, curthread); + KASSERT(ltype == LK_EXCLUSIVE || ltype == LK_SHARED, + ("vn_vget_ino: vp not locked")); + for (;;) { + error = vfs_busy(mp, LK_NOWAIT, NULL, curthread); + if (error == 0) + break; + VOP_UNLOCK(vp, 0, curthread); + pause("vn_vget", 1); + vn_lock(vp, ltype | LK_RETRY, curthread); + if (vp->v_iflag & VI_DOOMED) + return (ENOENT); + } + VOP_UNLOCK(vp, 0, curthread); + error = VFS_VGET(mp, ino, lkflags, rvp); + vfs_unbusy(mp, curthread); + vn_lock(vp, ltype | LK_RETRY, curthread); + if (vp->v_iflag & VI_DOOMED) { + if (error == 0) + vput(*rvp); + error = ENOENT; + } + return (error); +} Modified: stable/7/sys/sys/vnode.h ============================================================================== --- stable/7/sys/sys/vnode.h Sun Feb 22 03:02:46 2009 (r188909) +++ stable/7/sys/sys/vnode.h Sun Feb 22 10:17:10 2009 (r188910) @@ -633,6 +633,9 @@ int vn_extattr_set(struct vnode *vp, int const char *attrname, int buflen, char *buf, struct thread *td); int vn_extattr_rm(struct vnode *vp, int ioflg, int attrnamespace, const char *attrname, struct thread *td); +int vn_vget_ino(struct vnode *vp, ino_t ino, int lkflags, + struct vnode **rvp); + int vfs_cache_lookup(struct vop_lookup_args *ap); void vfs_timestamp(struct timespec *); void vfs_write_resume(struct mount *mp); Modified: stable/7/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- stable/7/sys/ufs/ufs/ufs_lookup.c Sun Feb 22 03:02:46 2009 (r188909) +++ stable/7/sys/ufs/ufs/ufs_lookup.c Sun Feb 22 10:17:10 2009 (r188910) @@ -158,7 +158,6 @@ ufs_lookup(ap) struct thread *td = cnp->cn_thread; ino_t ino; int ltype; - struct mount *mp; bp = NULL; slotoffset = -1; @@ -579,27 +578,7 @@ found: */ pdp = vdp; if (flags & ISDOTDOT) { - ltype = VOP_ISLOCKED(pdp, td); - mp = pdp->v_mount; - for (;;) { - error = vfs_busy(mp, LK_NOWAIT, NULL, td); - if (error == 0) - break; - VOP_UNLOCK(pdp, 0, td); - pause("ufs_dd", 1); - vn_lock(pdp, ltype | LK_RETRY, td); - if (pdp->v_iflag & VI_DOOMED) - return (ENOENT); - } - VOP_UNLOCK(pdp, 0, td); /* race to get the inode */ - error = VFS_VGET(mp, ino, cnp->cn_lkflags, &tdp); - vfs_unbusy(mp, td); - vn_lock(pdp, ltype | LK_RETRY, td); - if (pdp->v_iflag & VI_DOOMED) { - if (error == 0) - vput(tdp); - error = ENOENT; - } + error = vn_vget_ino(pdp, ino, cnp->cn_lkflags, &tdp); if (error) return (error); *vpp = tdp;