diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-10-12 17:44:01 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-10-12 17:44:01 +0000 |
commit | 4ba161010c514ab98d004af338fd6238894568db (patch) | |
tree | 6f5c2e321dbfaeb21de81de9059796f982b61cbb /pkg/sentry/kernel/kernel.go | |
parent | ae0ab57fdfcadf771cb849b79cdb6d6e0a4bdbbf (diff) | |
parent | d861cd5f14bc42b32eeac20c444a685f1d9748f7 (diff) |
Merge release-20200928.0-91-gd861cd5f1 (automated)
Diffstat (limited to 'pkg/sentry/kernel/kernel.go')
-rw-r--r-- | pkg/sentry/kernel/kernel.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/kernel.go b/pkg/sentry/kernel/kernel.go index d6c21adb7..16c427fc8 100644 --- a/pkg/sentry/kernel/kernel.go +++ b/pkg/sentry/kernel/kernel.go @@ -1738,3 +1738,18 @@ func (k *Kernel) ShmMount() *vfs.Mount { func (k *Kernel) SocketMount() *vfs.Mount { return k.socketMount } + +// Release releases resources owned by k. +// +// Precondition: This should only be called after the kernel is fully +// initialized, e.g. after k.Start() has been called. +func (k *Kernel) Release() { + if VFS2Enabled { + ctx := k.SupervisorContext() + k.hostMount.DecRef(ctx) + k.pipeMount.DecRef(ctx) + k.shmMount.DecRef(ctx) + k.socketMount.DecRef(ctx) + k.vfs.Release(ctx) + } +} |