Cc: Christoph Hellwig <hch@...>, Hans Reiser <reiser@...>, Alex Zarochentsev <zam@...>, <linux-fsdevel@...>, <linux-kernel@...>, Alexander Lyamin aka FLX <flx@...>, ReiserFS List <reiserfs-list@...>
Didn't someone just say that O_DIRECTORY will succeed on a device,
precisely because opendir() is supposed to succeed on the device?
I'm not sure. Let me refresh my memory.
Linus Torvalds wrote:
Oh, I see. You're right. ".." sees the path of directory branches.
It is not the kernel which decides. The filesystem containing
/dev/hda/part1 opens "the directory branch". If the filesystem is
suitably configured, it's exactly the same as opening a .zip or ELF
file: it asks userspace for help. Userspace helps by either mounting
it, or creating a container virtual directory -- in exactly the same
way it helps with .zip and ELF files by creating a container virtual
directory for those. It would mount it if the kernel supports the fs,
and create a virtual directory if the kernel doesn't support the fs
and userspace does.
This is exactly the same as when you cd into a filesystem image: the
helper mounts (this time with a lookback file mount) if the kernel
supports the image fs, otherwise the helper may be able to decode it
in userspace.
By the way, these mechanisms could allow some of the old filesystems
that nobody uses any more to be removed from the kernel altogether and
kept in an archive of userspace-only supported filesystems. What do
you think of that idea?
The obvious implementation has the userspace helper just mounting it,
end of story. If the mount command fails, it fails. Much like autofs.
-- Jamie