Subject: How .. is resolved at mountpoints
To: None <firstname.lastname@example.org>
From: Jonathan Fuerth <email@example.com>
Date: 03/15/2000 20:48:06
Hi. I asked this question in my OS class yesterday, and the prof couldn't
answer me. So I looked through the 4.4BSD implementation book, and it didn't
mention the answer either. I figure someone has to know. :)
How does the kernel's pathname->(device, inode) algorithm work when a
pathname of ".." is given to it when the current directory is the top level
of a mounted filesystem (other than the root filesystem, of course).
Also, which inode number is referenced by the .. directory entry of a
(currently or previously) mounted filesystem's root directory? Is it a
self-reference (i.e. inode 2) or does it reference an inode on the device
it's currently mounted under? It would seem odd to do that.
I learned a lot about vnodes in the 4.4BSD book.. they were entirely glossed
over in my OS course lectures. Since the vnode system plays a vital and
active part in resolving pathnames, I wonder if it catches ".." references
at mountpoints before the individual filesystem gets involved. That seems
cleanest, but there must have been something else in place before vnodes
entered the scene, which may or may not have been obsoleted when vnodes were
adopted by BSD.
Finally, I notice that when I fsck my filesystems (say, after a power failure)
I'm told where the filesystem was last mounted. How and where (and why) is
this information stored?
I know I've asked a fair bit here.. I don't want to disrupt the list with
a flood of lengthy responses, so feel free to mail any answers directly to me
if you feel they would otherwise pollute the list.