summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/mm/aio_mappable_refs.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-12-12 00:05:43 +0000
committergVisor bot <gvisor-bot@google.com>2020-12-12 00:05:43 +0000
commit445e57ac75a4c48e5455fdaf5b3e963594c15346 (patch)
treec2794d96cddf521e40e74bc0d26d000133cf3139 /pkg/sentry/mm/aio_mappable_refs.go
parent0aa7d2a4b264764152ef79db960e920f2e101780 (diff)
parent1e92732eb19ac5cfa3df6ff01cc1ea71d80a9198 (diff)
Merge release-20201208.0-36-g1e92732eb (automated)
Diffstat (limited to 'pkg/sentry/mm/aio_mappable_refs.go')
-rw-r--r--pkg/sentry/mm/aio_mappable_refs.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/pkg/sentry/mm/aio_mappable_refs.go b/pkg/sentry/mm/aio_mappable_refs.go
index 500477c1f..4b87070bf 100644
--- a/pkg/sentry/mm/aio_mappable_refs.go
+++ b/pkg/sentry/mm/aio_mappable_refs.go
@@ -54,11 +54,6 @@ func (r *aioMappableRefs) LogRefs() bool {
return aioMappableenableLogging
}
-// EnableLeakCheck enables reference leak checking on r.
-func (r *aioMappableRefs) EnableLeakCheck() {
- refsvfs2.Register(r)
-}
-
// ReadRefs returns the current number of references. The returned count is
// inherently racy and is unsafe to use without external synchronization.
func (r *aioMappableRefs) ReadRefs() int64 {
@@ -115,7 +110,7 @@ func (r *aioMappableRefs) TryIncRef() bool {
func (r *aioMappableRefs) DecRef(destroy func()) {
v := atomic.AddInt64(&r.refCount, -1)
if aioMappableenableLogging {
- refsvfs2.LogDecRef(r, v+1)
+ refsvfs2.LogDecRef(r, v)
}
switch {
case v < 0:
@@ -132,6 +127,6 @@ func (r *aioMappableRefs) DecRef(destroy func()) {
func (r *aioMappableRefs) afterLoad() {
if r.ReadRefs() > 0 {
- r.EnableLeakCheck()
+ refsvfs2.Register(r)
}
}