summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fs/mount.go
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2018-06-25 16:16:23 -0700
committerShentubot <shentubot@google.com>2018-06-25 16:17:12 -0700
commit1a9917d14d66250fdc9a3781ef65df4413340a2f (patch)
tree6b732372d89723f27b4fbe547f6eddc8b5680e57 /pkg/sentry/fs/mount.go
parent478f0ac0038afda267814fa154bcd32feb07c3b3 (diff)
MountSource.Root() should return a refernce on the dirent.
PiperOrigin-RevId: 202038397 Change-Id: I074d525f2e2d9bcd43b247b62f86f9129c101b78
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
}