summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_default.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-03-01 18:40:14 +0000
committerkib <kib@FreeBSD.org>2013-03-01 18:40:14 +0000
commit0da1880cbc10809b659cabb782a330c021999d1a (patch)
treec7a198349df48a04759d7be4edea5b43b30541fd /sys/kern/vfs_default.c
parent0bc64999312aebf9154a527d512d4c04a379fdd6 (diff)
downloadFreeBSD-src-0da1880cbc10809b659cabb782a330c021999d1a.zip
FreeBSD-src-0da1880cbc10809b659cabb782a330c021999d1a.tar.gz
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
Diffstat (limited to 'sys/kern/vfs_default.c')
-rw-r--r--sys/kern/vfs_default.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index 00d064e..1dd0185 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -856,8 +856,12 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap)
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);
OpenPOWER on IntegriCloud