Date: Sat, 4 Mar 2000 21:50:58 -0600 From: Dan Potter <shun@mail.utexas.edu> To: freebsd-current@freebsd.org Subject: Problems with 'pwd' and unionfs Message-ID: <20000304215058.A7124@industrial-strength.net>
next in thread | raw e-mail | index | archive | help
Hi all, I have been working with FreeBSD 4.0-current lately and I have found a strange thing or two. Here is the really big one that is stopping me from performing my evil experiments }-D When I mount a pass-through based file system (null and union both exhibit this behavior) more than one level deep into a real file system, pwd ceases to function under there. It gives me the error: pwd: .: No such file or directory This wouldn't be a big deal, but it causes a lot of problems -- if a shell tries to use one of these trees for a home directory, it prints an ugly message. Ftp doesn't work right (especially uploads). I'm sure there are more, but either way, I looked into it and I think I know what's wrong. 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 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! But it showed up. When I commented out the optimized parts and tried, it worked perfectly. I'm updating my source tree to do a full compile with the test getcwd to see if it fixes the problems I was seeing in general. But I figured I'd shoot that off to see if it sounds familiar to anyone since the real problem in current versions is in the kernel. The other union-related problem I've seen has to do with it sometimes not recognizing that a file or directory is there if I haven't traversed to it directly. I think this has something to do with the shadow directory creation, but I haven't had much time to look into that since it's not as much of a show-stopper. Thanks! PS, if anyone is interested in my aforementioned evil experiments, I'm creating a more complete virtual domain system that may be used at my company once 4.0 is closer to being released. We're using null/union to bring over a "skeleton fs" extracted from the "bin" distribution, and mounting a write tree on top of that per domain. Then a daemon is run within a jail environment to start and stop things inside the jail. It looks neat but obviously the union issues cause problems.. =) -- MAC user's dynamic debugging list evaluator? Never heard of that. 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?20000304215058.A7124>