svn commit: r247560 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Fri Mar 1 18:40:15 UTC 2013
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);
More information about the svn-src-head
mailing list