Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jan 2010 23:48:47 +0000 (UTC)
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r202994 - stable/7/sys/kern
Message-ID:  <201001252348.o0PNmlnr014778@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001252348.o0PNmlnr014778>