diff options
author | Jamie Liu <jamieliu@google.com> | 2020-05-28 19:14:26 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-28 19:16:06 -0700 |
commit | 50844fee29aed500fff41f417f6183867ca0f0b5 (patch) | |
tree | 91d912aae4911b9fac0ccc555205e744778f5f6d /pkg/sentry/vfs/vfs.go | |
parent | f7418e21590e271302a3c375323950c209ce5ced (diff) |
Split VFS.MountAt into VFS.MountDisconnected and VFS.ConnectMountAt.
This makes it straightforward to create bind mounts internally in VFS2: Given a
bind mount root represented by vfs.VirtualDentry vd:
- Create a new mount with VFS.NewDisconnectedMount(vd.Mount().Filesystem(),
vd.Dentry()).
- Connect the resulting mount in the appropriate namespace with
VFS.ConnectMountAt().
Note that the resulting bind mount is non-recursive; recursive bind mounting
requires explicitly duplicating all children of the original mount, which is
best handled internally by VFS.
Updates #179
PiperOrigin-RevId: 313703963
Diffstat (limited to 'pkg/sentry/vfs/vfs.go')
-rw-r--r-- | pkg/sentry/vfs/vfs.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/sentry/vfs/vfs.go b/pkg/sentry/vfs/vfs.go index 8d7f8f8af..6d2ba53ea 100644 --- a/pkg/sentry/vfs/vfs.go +++ b/pkg/sentry/vfs/vfs.go @@ -82,6 +82,10 @@ type VirtualFilesystem struct { // mountpoints is analogous to Linux's mountpoint_hashtable. mountpoints map[*Dentry]map[*Mount]struct{} + // lastMountID is the last allocated mount ID. lastMountID is accessed + // using atomic memory operations. + lastMountID uint64 + // anonMount is a Mount, not included in mounts or mountpoints, // representing an anonFilesystem. anonMount is used to back // VirtualDentries returned by VirtualFilesystem.NewAnonVirtualDentry(). |