Right. The reason you have to do this is because the VFS layer actually
uses the negative dentry for a few things:
- it's a negative cache, so that the VFS layer doesn't need to call down
to the filesystem the next time around if somebody keep trying to look
up nonexistent files (which happens a lot with path lookup, for
example).
- a negative dentry is also a placeholder for _becoming_ a real dentry.
When you create a new file, you will do a lookup of the file which will
start out as a negative dentry, and then the create function will turn
that negative dentry into a real dentry.
The second use for negative dentries allows us to do various things a lot
more cleanly than the old code did - creating a new file by following a
symlink is just one of these. The old code had to do this in two stages:
first look up all but the last part of the filename, and then handle the
last part specially. The new dentry code avoids all special cases, to a
large degree thanks to using negative dentries.
Linus