Re: dcache questions

Gordon Chaffee (chaffee@CS.Berkeley.EDU)
Tue, 30 Dec 1997 21:10:00 -0800 (PST)


Hildo Biersma writes:
> On Dec 30, Gordon Chaffee wrote
> >
> > This really starts messing with the dcache since there is not a unique
> > dentry for any filename or directory.
> >
> > 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.
>
> Hmm... isn't this the same case as multiple hard links to a file?
> The dache handles those by just including all names.
>
> You might follow that approach, and then take special action on renames
> and deletes (as vfat multiple names are related while hard links are
> not).

A number of people have suggested handling aliases just like hard links.
There are a couple of significant differences: when I remove a hard link,
the file continues to exist. This means that any other hard links to
that file continue to be valid. This doesn't sound like much of a problem
until you consider the following:

1# ls -l "progra~1/gnuema~1/longfi~1.exe"
2# rm "Program Files/GNU Emacs/LongFileName.exe"
3# ls -l "progra~1/gnuema~1/longfi~1.exe"

Assuming the file existed in the beginning, steps 1 and 2 succeed. In
the removal of the filename, we need to remove all dentries that refer
to this file from the dcache, so we would need a way to find all dentries
for a given inode. In the above sequence, 3 should fail, but it will
succeed unless the dentries are removed.

Similarly, if the filename does not exist but the directories do,

4# ls -l "progra~1/gnuema~1/longfi~1.exe"
5# touch "Program Files/GNU Emacs/LongFileName.exe"
6# ls -l "progra~1/gnuema~1/longfi~1.exe"

4 should fail, 5 should succeed, and 6 should succeed. If the dcache
is not properly updated by removing equivalent negative dentries, 6
will fail.

- Gordon