From owner-svn-src-stable-7@FreeBSD.ORG Mon Jan 25 23:48:48 2010 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14F651065679; Mon, 25 Jan 2010 23:48:48 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 02D998FC20; Mon, 25 Jan 2010 23:48:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0PNml3K014780; Mon, 25 Jan 2010 23:48:47 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0PNmlnr014778; Mon, 25 Jan 2010 23:48:47 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201001252348.o0PNmlnr014778@svn.freebsd.org> From: Colin Percival Date: Mon, 25 Jan 2010 23:48:47 +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: r202994 - stable/7/sys/kern X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jan 2010 23:48:48 -0000 Author: cperciva Date: Mon Jan 25 23:48:47 2010 New Revision: 202994 URL: http://svn.freebsd.org/changeset/base/202994 Log: Add support for "at vp" lookups to namei. This functionality was added to HEAD in r185029; but this is an "inspired by" commit rather than a literal merge, since this region of code in HEAD has other non-MFCable changes. The namei lookups this unbreaks are required for ZFS extended attributes; prior to this commit, an attempt to look up (list, read, write, delete) extended attributes would be handled as an attempt to look up a file in the current directory if an extended attribute directory existed ("at vp" was mishandled as "right here"). Reviewed by: jhb Approved by: re (kib) Found by: Henrik Wiest & libarchive Modified: stable/7/sys/kern/vfs_lookup.c Modified: stable/7/sys/kern/vfs_lookup.c ============================================================================== --- stable/7/sys/kern/vfs_lookup.c Mon Jan 25 23:44:00 2010 (r202993) +++ stable/7/sys/kern/vfs_lookup.c Mon Jan 25 23:48:47 2010 (r202994) @@ -191,10 +191,26 @@ namei(struct nameidata *ndp) ndp->ni_rootdir = fdp->fd_rdir; ndp->ni_topdir = fdp->fd_jdir; - dp = fdp->fd_cdir; + if (ndp->ni_startdir != NULL) { + dp = ndp->ni_startdir; + FILEDESC_SUNLOCK(fdp); + if (dp->v_type != VDIR) { + vfslocked = VFS_LOCK_GIANT(dp->v_mount); + vrele(dp); + VFS_UNLOCK_GIANT(vfslocked); + uma_zfree(namei_zone, cnp->cn_pnbuf); +#ifdef DIAGNOSTIC + cnp->cn_pnbuf = NULL; + cnp->cn_nameptr = NULL; +#endif + return (ENOTDIR); + } + } else { + dp = fdp->fd_cdir; + VREF(dp); + FILEDESC_SUNLOCK(fdp); + } vfslocked = VFS_LOCK_GIANT(dp->v_mount); - VREF(dp); - FILEDESC_SUNLOCK(fdp); for (;;) { /* * Check if root directory should replace current directory.