Cc: Linus Torvalds <torvalds@...>, Christoph Hellwig <hch@...>, Hans Reiser <reiser@...>, <linux-fsdevel@...>, <linux-kernel@...>, Alexander Lyamin aka FLX <flx@...>, ReiserFS List <reiserfs-list@...>
Ok, so can we make it so mountpoints can be unlinked? :)
The mount would continue to exist, but with no name, until its last
user disappears.
I think the underlying file does not stay locked, and once you've
entered it as a directory, it can be unlinked.
If you have the directory open or chdir into it, then it _may_ have
the effect of keeping the file's storage allocated when you unlink it
-- just like when a file is unlinked while opened. As that is not a
user-visible property, it's a filesystem-specific implementation
detail as to whether it keeps the file's data in existence while the
metadata directories and/or files are open.
I didn't mean locking a chain of mountpoints, I meant the temporary
state where two dentries and/or inodes are locked, parent and child,
during a path walk. However I'm not very familiar with that part of
the VFS and I see that the current RCU dcache might not lock that much
during a path walk.
I agree, users shouldn't be able to pin down a file.
I think unlink() should succeed on a file while something is visiting
inside its metadata directory.
It's a filesystem quality-of-implementation feature whether that
actually releases the file's data. It's a desirable feature because
one user shouldn't be able to pin another user's quota'd data if they
don't have permission to open the file, but if it's not implemented by
a filesystem then it doesn't break anything fundamental.
It's a semantics question whether unlinking a file makes the metadata
(i.e. "uid", "mode", "content-type" etc.) disappear at the same time,
or if the metadata stays around until the last visitor leaves it. A
filesystem might be able to keep the metadata in existence even if it
deletes the file's storage on unlink(), but it would be nice for the
VFS to declare which semantic is preferred.
One of the big potential uses for file-as-directory is to go inside
archive files, ELF files, .iso files and so on in a convenient way.
In those cases, if you open one of the virtually generated "archive
content" files, then you might expect the data to continue to exist
after the underlying file is unlinked. I think that's reasonable:
being inside an archive is very similar to having it open. There is
no quota pinning problem with this, because "archive content" files
should inherit permission restrictions from the underlying file. If
you can't read the file, then you can't read it's unpacked contents.
(reiser4 doesn't offer that last feature, but any of the myriad
userspace filesystem hooks could offer it if the VFS has approprate
auto-mounting file-as-directory hooks).
-- Jamie