Miklos Szeredi <[EMAIL PROTECTED]> wrote: >> > This one should work, since the file descriptor in the working >> > directory should prevent the inode from going away. Or is there >> > something I'm missing? >> >> We like to have a way of searching a directory hierarchy 100000 levels >> deep without needing to have 100000 open file descriptors. > > No, you only need _one_ file descriptor for the current directory. > That will hold a reference to all indodes above that in the tree, > which is what you need to be able to detect a cycle.
But what about symlinks? a g b h->a c f->g The moment you traverse the f->g symlink above, the entire tree, a/b/c/f, is no longer referenced, so the h->a link may take you back to a new inode, and the cycle will not be detected.