> > > > Shouldn't holding the current directory open prevent the ancestor from > > changing inodes in this case? > > No. > What's changed is the identity (dev/inode) of the parent directory, > once you try to chdir("..") "up" beyond the renamed directory.
I understand, that that is the case you want to detect. But in the normal case (no changes in topology) the parent was referenced thoughout traversing it's subtree, hence it's inode number cannot have changed even for an inode-less filesystems. So I think the problem we are seeing is not for traversing up the tree, but for traversing down it. In which case the check is not needed (if O_NOFOLLOW is also available). Miklos