On Sat, 4 Mar 2000, Dan Potter wrote:
> ...
> In libc there is a non-kernel version of getcwd that runs lstat() on each
> directory and then searching its parent, trying to divine which sub-tree
> is '.' at the time. I dumped a copy of that into a copy of pwd.c to trace
> through it and see what happens. Basically for optimization purposes it
> looks like it just uses the inode value from readdir() until it thinks
> that it's changed volumes, and then it runs lstat() on each entry to make
This is supposed to work. (st_dev, st_ino) pairs returned by lstat() and
stat() are supposed to be unique.
> sure which one it is. Well, this breaks unionfs mounts because the device
> inode is the same, but the inode numbers are different since it's a mount
> point. What a subtle problem!
st_dev for a mount on non-device is normally copied from the fsid for the
mount. See kern/vfs_vnops.c:vn_stat(). This works for nfs mounts.
Unfortunately, for union mounts, VOP_GETTATTR() normally finds a non-VNOVAL
va_fsid by going to the leaf filesystem, and st_dev is set to this. I
think the fsid should be used in all cases (change f_fsid.val[0] for
mounts on real devices if necessary).
Bruce
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message