vfs: Implement mount_super_once

The devpts filesystem has a notion of a system or primary instance of
devpts.  To retain the notion of a primary system instance of devpts
the code needs a way to allow userspace to mount the internally
mounted instance of devpts when it is not currently mounted by
userspace.  The new helper mount_super_once allows that.

The function mount_super_once ignores vfsmounts that are in use but
are not mounted in userspace.  The set of ignored mounts includes
internal mounts, lazily unmounted instances of mounts, and
loopback/bind mounts show root directory is not a filesystems root
directory.

Furthermore mount_super_once only allows exporting a mount to
userspace if it can account for every reference in s_active
on the superblock.  Ensuring races do not allow two simultaneous
mount requestions export the same filesystem to userspace.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2 files changed