Indeed. That's nasty.
>I decided I would try to handle the problem with aliases by not putting
>any dentries in the dcache for filenames that are aliases or for filenames
>that haven't been found. This way, there would only be one dentry per
>directory and file.
No, as you found out that doesn't work. The VFS really depends on the
dentries existing.
The real solution is as far as I can tell:
- don't allow the short aliases at all - only show LongFileName.exe,
and never show or accept longfi~1.exe. This is the quick and
dirty fix. Not recommended, and probably hard.
- make the filesystem-specific hashing and name comparing functions
compare the two names as equal - so that only one dentry exists for
both of them. This is the "real" fix, but depending on how the name
mangling works it may not be all that easy.
The real fix may mean that you can only use the first six characters for
the hash (and you have to mush together cases, obviously), and then
making sure the lookup function compares the strange endings correctly
too.
So the VFS dentry layer does support these kinds of aliases, but it may
be extremely non-trivial to actually get the compare functions working
correctly. You may end up having to do pretty much the same as you do
in the filename lookup function in the name compare code..
Linus