On 30 Dec 1997, Linus Torvalds wrote:
> In article <199712301225.EAA29094@quimby.cs.berkeley.edu>,
> Gordon Chaffee <chaffee@quimby.cs.berkeley.edu> wrote:
> >I'm having some significant problems trying to get the vfat filesystem
> >to work properly with the dcache. Basically, the problem is caused by
> >the vfat filename handling. For each long filename, there is an alias
> >that refers to the same file or directory. For example, for the filename
> >LongFileName, there is an alias called longfi~1.
> >
> >For a directory tree, I could have something like:
> > Long: Program Files/GNU Emacs/LongFileName.exe
> > Alias: progra~1/gnuema~1/longfi~1.exe
> >
> >One can also refer to LongFileName.exe via one of any combination of
> >aliased directory names:
> > progra~1/GNU Emacs/LongFileName.exe
> > Program Files/gnuema~1/longfi~1.exe
> >
> >This really starts messing with the dcache since there is not a unique
> >dentry for any filename or directory.
>
> 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
>