Re: patch for fs/dcache race

James Mastros (root@jennifer-unix.dyn.ml.org)
Tue, 12 Aug 1997 13:46:29 -0400 (EDT)


On Mon, 11 Aug 1997, Bill Hawes wrote:

> Linus Torvalds wrote:
> > The bad news is:
> > - "cat /proc/<xxx>/fd/<foo>" will report "foo" to be named "huh", because
> > in the above horror-example we couldn't do the thing we wanted (which
> > was to turn it into a negative dentry). This is ugly, because the file
> > that we point to with "foo" has never ever actually been named "huh" -
> > it only got overwritten with a file called "huh".
> >
> > However. The bad news isn't really bad (there is no real path that we
> > could follow to "foo" anyway, so in some sense any path is as good as any
> > other path). And the good news is that the new code is extremely efficient
> > and simple, and gives exactly the semantics we want apart from this one
> > very slight strange quirk.

Perhaps either (1) We should have the path display as <deleted>, or (2) have
the /proc/<xxx>/fd/n BE the real file; that is, set it's d_inode to point to
the inode of the deleted file. But to do that, we would have to (1) check
for the case of deleting a open file when there are no other (hard) links to
it, (2) somehow inform the FS level that there is a hard link to the file
that is not on that FS, (3) inform the FS level when the file is closed
(then again, we alredy do that, no?), (4) strugle with the security holes
opened by that... (I.E. - What permissions should that file have? Can the proc
fs deal with files of varing permissions?).

So, it dosn't seem like it's worth it. On the other hand, this would have
the side effects of making a generilised interface for hard links that can
deal with hard links to outside of the filesystem, which seems like a step
twords^H^H^H^H^Hcloser to loopback mounts, compressed (including "strange
and inefficient compression alogrithims like PGP") filesystems, etc...
Also, it might be a Good Thing for good undeleton schemes (the on-disk inode
should be marked as deleted, but still have it's list of blocks. Also,
deleted inodes shouldn't be reused untill the free inode count gets real low
(like zero). But lets not re-hash that battle, eh?

-=- James Mastros