Re: Of removable devices

From: Alexander Viro (viro@math.psu.edu)
Date: Tue Feb 15 2000 - 11:46:57 EST


On 15 Feb 2000, Francis GALIEGUE wrote:

> Alexander Viro <viro@math.psu.edu> writes:
>
> >
> > > Moreover, this situation is not very different from
> > > opening a file on disk and deleting it in another window. The only
> > > difference is that it'd be killed if the media is gone.
> >
> > Yes, it is. Unlinked files are still there, still readable/writable/whatever.
> > If you don't know this sort of basic things - pardon me when I'm sceptical
> > about your suggestions regarding VFS.
> >
>
> A file is backlinked to the fs superblock, isn't it?

Not. _Please_, read any introductory text on UNIX. Seriously. Files on
UNIX are nameless. Directories contain pairs (name, reference to file).
File may be referenced from any number of places. When you open it you
are getting a reference to file. Period. From that moment on names are out
of the game. Obviously, file can't be discarded if there are references in
directories or if somebody is using it. If you unlink the file you remove
the reference in a directory. It has _no_ effect on the file existence.
Now, if nobody uses it _and_ this was the last reference - fine, file can
be safely discarded (nobody will ever access it). Same for close(). Actual
discarding the file is a sort of garbage collection - it has _nothing_
with removing links to file.

Again, files do no sit in directories. They exist on their own.
And unlink() only removes a reference in a directory.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:30 EST