Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Mar 2000 19:06:45 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Dan Potter <shun@mail.utexas.edu>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: Problems with 'pwd' and unionfs
Message-ID:  <Pine.BSF.4.21.0003081845520.764-100000@alphplex.bde.org>
In-Reply-To: <20000304215058.A7124@industrial-strength.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0003081845520.764-100000>