Re: [RFC PATCH] vfs: syscalls: Add create_automount() and remove_automount()

From: David Howells
Date: Wed Feb 19 2020 - 14:58:15 EST


Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> > Why don't you just use mkdir with S_ISVTX set, or something like that?
>
> Actually, since this is apparently a different filetype, the _logical_
> thing to do is to use "mknod()".

Actually, in many ways, they're more akin to symlinks (and are implemented as
symlinks with funny attributes). It's a shame that symlinkat() doesn't have
an at_flags parameter.

mknod() isn't otherwise supported on AFS as there aren't any UNIX special
files.

> You presumably need a new type _anyway_ for stat() and/or the filldir
> d_type field. Or do you always want to make it look exactly like a
> directory to all user space?

That's already dealt with. They're presented as directories with
STATX_ATTR_AUTOMOUNT showing when you call statx() on them. You can also use
readlink() to extract the target if they haven't been mounted over yet.

Inside the kernel, they have no ->lookup() op, so DCACHE_AUTODIR_TYPE is set
on the dentry and there's a ->d_automount() op. The inode has S_AUTOMOUNT
set. That's all taken care of when the inode is created and the dentry is
instantiated.

Davod