diff options
Diffstat (limited to 'pkg/sentry/fsimpl/host')
-rw-r--r-- | pkg/sentry/fsimpl/host/connected_endpoint_refs.go | 9 | ||||
-rw-r--r-- | pkg/sentry/fsimpl/host/inode_refs.go | 9 |
2 files changed, 4 insertions, 14 deletions
diff --git a/pkg/sentry/fsimpl/host/connected_endpoint_refs.go b/pkg/sentry/fsimpl/host/connected_endpoint_refs.go index 3f5f4ebc3..d784166ae 100644 --- a/pkg/sentry/fsimpl/host/connected_endpoint_refs.go +++ b/pkg/sentry/fsimpl/host/connected_endpoint_refs.go @@ -54,11 +54,6 @@ func (r *ConnectedEndpointRefs) LogRefs() bool { return ConnectedEndpointenableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *ConnectedEndpointRefs) 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 *ConnectedEndpointRefs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *ConnectedEndpointRefs) TryIncRef() bool { func (r *ConnectedEndpointRefs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if ConnectedEndpointenableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *ConnectedEndpointRefs) DecRef(destroy func()) { func (r *ConnectedEndpointRefs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } diff --git a/pkg/sentry/fsimpl/host/inode_refs.go b/pkg/sentry/fsimpl/host/inode_refs.go index 4c850a7ac..8862c4a5e 100644 --- a/pkg/sentry/fsimpl/host/inode_refs.go +++ b/pkg/sentry/fsimpl/host/inode_refs.go @@ -54,11 +54,6 @@ func (r *inodeRefs) LogRefs() bool { return inodeenableLogging } -// EnableLeakCheck enables reference leak checking on r. -func (r *inodeRefs) 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 *inodeRefs) ReadRefs() int64 { @@ -115,7 +110,7 @@ func (r *inodeRefs) TryIncRef() bool { func (r *inodeRefs) DecRef(destroy func()) { v := atomic.AddInt64(&r.refCount, -1) if inodeenableLogging { - refsvfs2.LogDecRef(r, v+1) + refsvfs2.LogDecRef(r, v) } switch { case v < 0: @@ -132,6 +127,6 @@ func (r *inodeRefs) DecRef(destroy func()) { func (r *inodeRefs) afterLoad() { if r.ReadRefs() > 0 { - r.EnableLeakCheck() + refsvfs2.Register(r) } } |