Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Mar 2013 18:40:15 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r247560 - head/sys/kern
Message-ID:  <201303011840.r21IeF27046235@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Mar  1 18:40:14 2013
New Revision: 247560
URL: http://svnweb.freebsd.org/changeset/base/247560

Log:
  Make the default implementation of the VOP_VPTOCNP() fail if the
  directory entry, matched by the inode number, is ".".
  
  NFSv4 client might instantiate the distinct vnodes which have the same
  inode number, since single v4 export can be combined from several
  filesystems on the server.  For instance, a case when the nested
  server mount point is exactly one directory below the top of the
  export, causes directory and its parent to have the same inode number
  2.  The vop_stdvptocnp() algorithm then returns "." as the name of the
  lower directory.
  
  Filtering out the "." entry with ENOENT works around this behaviour,
  the error forces getcwd(3) to fall back to usermode implementation,
  which compares both st_dev and st_ino.
  
  Based on the submission by:	rmacklem
  Tested by:	rmacklem
  MFC after:	1 week

Modified:
  head/sys/kern/vfs_default.c

Modified: head/sys/kern/vfs_default.c
==============================================================================
--- head/sys/kern/vfs_default.c	Fri Mar  1 18:39:55 2013	(r247559)
+++ head/sys/kern/vfs_default.c	Fri Mar  1 18:40:14 2013	(r247560)
@@ -856,8 +856,12 @@ vop_stdvptocnp(struct vop_vptocnp_args *
 				error = ENOMEM;
 				goto out;
 			}
-			bcopy(dp->d_name, buf + i, dp->d_namlen);
-			error = 0;
+			if (dp->d_namlen == 1 && dp->d_name[0] == '.') {
+				error = ENOENT;
+			} else {
+				bcopy(dp->d_name, buf + i, dp->d_namlen);
+				error = 0;
+			}
 			goto out;
 		}
 	} while (len > 0 || !eofflag);



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