lkml.org 
[lkml]   [1997]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: patch for fs/dcache race
Sounds like Linux just got undelete capabilities (independant of the
filesystem even...) Very cool.

-Erik

--
Erik B. Andersen Web: http://www.inconnect.com/~andersen/
email: andersee@debian.org
--This message was written using 73% post-consumer electrons--


On Tue, 12 Aug 1997, Linus Torvalds wrote:

>
>
> On Tue, 12 Aug 1997, James Mastros 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.
>
> Look into 2.1.49.
>
> It displays a "(deleted)" after the filename if the file is deleted (so
> you know that the name is really only a "hint" - but it does tell you on
> which filesystem the file is open, for example, which is valid information
> worth getting. Think "fuser").
>
> And yes, when you actually open the file through the /proc filesystem you
> _will_ get the correct (deleted) file even though the link displayed by
> "ls -l" isn't a valid name any more.
>
> Example:
>
> [torvalds@penguin torvalds]$ echo hello > hello ; ( rm hello ; ls -l /proc/self/fd ; cat /proc/self/fd/0 ) < hello
> total 0
> -> lr-x------ 1 torvalds torvalds 64 Aug 12 10:54 0 -> /export/home/penguin/torvalds/hello (deleted)
> lrwx------ 1 torvalds torvalds 64 Aug 12 10:54 1 -> /dev/ttyp0
> lrwx------ 1 torvalds torvalds 64 Aug 12 10:54 2 -> /dev/ttyp0
> lr-x------ 1 torvalds torvalds 64 Aug 12 10:54 3 -> /proc/22193/fd
> -> hello
> [torvalds@penguin torvalds]$
>
>
> Notice how the "cat /proc/self/fd/0" still works, even though the file is
> deleted (and shows up as "(deleted)" in the /proc listing).
>
> Yes, it's cool.
>
> Linus
>
>


\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.075 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site