summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/mount.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/fs/mount.go')
-rw-r--r--pkg/sentry/fs/mount.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/sentry/fs/mount.go b/pkg/sentry/fs/mount.go
index a2943b097..1d05a36a7 100644
--- a/pkg/sentry/fs/mount.go
+++ b/pkg/sentry/fs/mount.go
@@ -198,10 +198,12 @@ func (msrc *MountSource) Submounts() []*MountSource {
return ms
}
-// Root returns the root dirent of this mount.
+// Root returns the root dirent of this mount. Callers must call DecRef on the
+// returned dirent.
func (msrc *MountSource) Root() *Dirent {
msrc.mu.Lock()
defer msrc.mu.Unlock()
+ msrc.root.IncRef()
return msrc.root
}