VFS autmounter support v2
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 17 lines · David Howells
I think this can make use of my suggested change... If you make a trigger fs that has its root directory simply an automount point (though this leads me to think that perhaps (u)mount should follow the example of stat and use
LOOKUP_NOAUTOMOUNT).Perhaps:
[namespace X]
mount/dev/hda8/usr/include
mount -t trap "mount-fs-B"/usr/include/foo1mount -t trap "mount-fs-C"/usr/include/foo2[namespace Y]
mount/dev/hda8/usr/local/include
mount -t trap "mount-fs-D"/usr/local/include/foo1
Quoted 6 lines
Then have a daemon that can take a request to mount and then reply with the mount parameters, allowing the trap fs to obtain a vfsmount via
do_kern_mount(). I would make the trap fs supply the daemon with an fd attached to the trap rootdir to act as a token representing the request (and controlling its lifetime).
You would have to go this route. I think Al's opinion in this is that your original proposal allows arbitrary dentry's in the tree to act as traps. As such, there is no way for a derived namespace to manipulate that trap at all. By implying that the trap is installed via mount says you are now proposing that every trap is represented by its own superblock.
You're new proposal is exactly what I have been working on, autofs direct mountpoints using the less intrusive follow_link magic Anvin has mentioned on a previous thread both here and on autofs@vger.
The one problem with this solution is the following breaks:
# installtrap /foo host:/export/foo <userspace daemon listens for requests to mount> # newnssh newnssh # cd /foo
Oops, the daemon started from the initial namespace doesn't have access to the namespace in my second shell.
The most reasonable way I can see to cope with this is to allow CAP_SYS_ADMIN processes the ability to change namespaces. Eg, the daemon can be told which pid triggered the trap on /foo, open(/proc/<pid>/mounts) and perform a ioctl(IOC_USENAMESPACE) on it.
What do you guys think?
Mike Waychison
Quoted 8 lines
Quoted 7 lines
Then have a daemon that can take a request to mount and then reply with the mount parameters, allowing the trap fs to obtain a vfsmount via
do_kern_mount(). I would make the trap fs supply the daemon with an fd attached to the trap rootdir to act as a token representing the request (and controlling its lifetime).
Quoted 7 lines
You would have to go this route. I think Al's opinion in this is that your original proposal allows arbitrary dentry's in the tree to act as traps. As such, there is no way for a derived namespace to manipulate that trap at all.
By implying that the trap is installed via mount says you are now proposing that every trap is represented by its own superblock.
This is more or less what Al suggested, except that he suggested "traps" are special vfsmounts that don't have superblocks, dentries, and inodes.
Quoted 6 lines
You're new proposal is exactly what I have been working on, autofs direct mountpoints using the less intrusive
follow_linkmagic Anvin has mentioned on a previous thread both here and on autofs@vger.The one problem with this solution is the following breaks:
Quoted 7 lines
# installtrap /foo host:/export/foo <userspace daemon listens for requests to mount> # newnssh newnssh # cd /fooOops, the daemon started from the initial namespace doesn't have access to the namespace in my second shell.
Yes. You can see that happening now with autofs and amd. However it does work with my suggestion because the "automounter" code just returns a namespace independent vfsmount, which the VFS can then bind into the appropriate namespace and the appropriate place.
Quoted 6 lines
The most reasonable way I can see to cope with this is to allow
CAP_SYS_ADMINprocesses the ability to change namespaces. Eg, the daemon can be told which pid triggered the trap on /foo, open(/proc/<pid>/mounts) and perform aioctl(IOC_USENAMESPACE)on it.What do you guys think?
I think a better way is for the kernel to pass the daemon a file descriptor attached to the mount point. This would then act as a token representing the request, and as such it automatically includes the mount point info (struct file has vfsmount/dentry pointers) and can also be used to manage the lifetime of the request.
I'd then make there be either a "mount" ioctl/fcntl on that fd that uses the info stored on the struct file, or perhaps provide an "fmount" syscall (but you have to be careful - otherwise someone can use an arbitrary cross-namespace fd to mangle some other namespace).
David
Quoted 14 lines · David Howells
Quoted 11 lines
Quoted 8 lines
Then have a daemon that can take a request to mount and then reply with the mount parameters, allowing the trap fs to obtain a vfsmount via
do_kern_mount(). I would make the trap fs supply the daemon with an fd attached to the trap rootdir to act as a token representing the request (and controlling its lifetime).You would have to go this route. I think Al's opinion in this is that your original proposal allows arbitrary dentry's in the tree to act as traps. As such, there is no way for a derived namespace to manipulate that trap at all.
Quoted 8 lines
Quoted 4 lines
By implying that the trap is installed via mount says you are now proposing that every trap is represented by its own superblock.
This is more or less what Al suggested, except that he suggested "traps" are special vfsmounts that don't have superblocks, dentries, and inodes.
Introducing special trap vfsmounts w/o super_blocks means we can no longer have arbitrary actions on those traps. AFS wants to define what happens in kernelspace, autofs wants to define it in userspace. Last I checked, vfsmount doesn't have an ops structure.
Quoted 12 lines
Quoted 12 lines
You're new proposal is exactly what I have been working on, autofs direct mountpoints using the less intrusive
follow_linkmagic Anvin has mentioned on a previous thread both here and on autofs@vger.The one problem with this solution is the following breaks:
# installtrap /foo host:/export/foo <userspace daemon listens for requests to mount> # newnssh newnssh # cd /foo
Quoted 9 lines
Quoted 3 lines
Oops, the daemon started from the initial namespace doesn't have access to the namespace in my second shell.
Yes. You can see that happening now with autofs and amd. However it does work with my suggestion because the "automounter" code just returns a namespace independent vfsmount, which the VFS can then bind into the appropriate namespace and the appropriate place.
This only works for mounts performed in kernel space. It doesn't lend itself to performing mounts in userspace and would force autofs to re-implement mount(1) parsing/struct packing in kernelspace. Definitely not a good solution.
Quoted 15 lines
Quoted 8 lines
The most reasonable way I can see to cope with this is to allow
CAP_SYS_ADMINprocesses the ability to change namespaces. Eg, the daemon can be told which pid triggered the trap on /foo, open(/proc/<pid>/mounts) and perform aioctl(IOC_USENAMESPACE)on it.What do you guys think?
I think a better way is for the kernel to pass the daemon a file descriptor attached to the mount point. This would then act as a token representing the request, and as such it automatically includes the mount point info (struct file has vfsmount/dentry pointers) and can also be used to manage the lifetime of the request.
Quoted 6 lines
I'd then make there be either a "mount" ioctl/fcntl on that fd that uses the info stored on the struct file, or perhaps provide an "fmount" syscall (but you have to be careful - otherwise someone can use an arbitrary cross-namespace fd to mangle some other namespace).
A mount ioctl on the fd is probably a good idea:
- it would require modifying mount(1) so that you can have it use
the fd ioctl in lieu of sys_(old)mount.
- he have to ask ourselves, does this logic really belong in vfs? or
is it better placed in a filesystem-independent implementation.
I'm still partial to the idea that a usenamespace ioctl on /proc/<pid>/mounts is a cleaner solution in the long run, both for automounting as well as for administration tools.
Mike Waychison
Quoted 4 lines · Mike Waychison
Introducing special trap vfsmounts w/o
super_blocksmeans we can no longer have arbitrary actions on those traps. AFS wants to define what happens in kernelspace, autofs wants to define it in userspace. Last I checked, vfsmount doesn't have an ops structure.
It would have send an event over attached opened file. Attached at creation time.
Quoted 4 lines
This only works for mounts performed in kernel space. It doesn't lend itself to performing mounts in userspace and would force autofs to re-implement mount(1) parsing/struct packing in kernelspace. Definitely not a good solution.
Or if passed event contains opened mountpoint-to-be.
Quoted 3 lines
I'm still partial to the idea that a usenamespace ioctl on /proc/<pid>/mounts is a cleaner solution in the long run, both for automounting as well as for administration tools.
Vetoed. ioctl() is _not_ an acceptable way to implement any generic functionality. It basically says "my interface is a garbage".
And yes, we need to think about a new syscall for mount-related work. With sane API - mount(2) one is _not_. sys_mount() would still stay, obviously.
Quoted 11 lines · [email protected] wrote:
Quoted 3 lines · Mike Waychison
Introducing special trap vfsmounts w/o
super_blocksmeans we can no longer have arbitrary actions on those traps. AFS wants to define what happens in kernelspace, autofs wants to define it in userspace. Last I checked, vfsmount doesn't have an ops structure.It would have send an event over attached opened file. Attached at creation time.
That's a pretty good idea then :)
Quoted 9 lines
Quoted 6 lines
This only works for mounts performed in kernel space. It doesn't lend itself to performing mounts in userspace and would force autofs to re-implement mount(1) parsing/struct packing in kernelspace. Definitely not a good solution.
Or if passed event contains opened mountpoint-to-be.
By this, I assume you are implying that infrastructure for mounting on a given struct file (w/ S_ISDIR) would be made. Correct?
How would this kind of trap be installed in userspace? 'mount -t trap -o fd=# none /trappoint' which gets caught by the vfs layer in a special manner I suppose? The vfs system would of course be responsible for pipe errors/closure. As well, the passed opened mountpoint-to-be would have to be owned by the process owning the reading end of the pipe.
Quoted 10 lines
Quoted 6 lines
I'm still partial to the idea that a usenamespace ioctl on /proc/<pid>/mounts is a cleaner solution in the long run, both for automounting as well as for administration tools.
Vetoed.
ioctl()is _not_ an acceptable way to implement any generic functionality. It basically says "my interface is a garbage".
Alright. Automounting aside, does it still make sense to have *some* way for a sys-admin to join an existing namespace? sys_pushns(pid_t pid)/sys_popns() perhaps? Administrating an environment with multiple running namespaces may become difficult to administer without such capability.
Quoted 5 lines
And yes, we need to think about a new syscall for mount-related work. With sane API - mount(2) one is _not_.
sys_mount()would still stay, obviously.
What is not sane about mount(2)? Are you talking about the move/bind/remount functionality?
Mike Waychison