summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/kernfs
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-08-19 04:57:55 +0000
committergVisor bot <gvisor-bot@google.com>2020-08-19 04:57:55 +0000
commitb25f808c5507b5fcc5855ce674a6b4d0cea27912 (patch)
tree47a313e10053d50121c66d9e5c65bc8728c42547 /pkg/sentry/fsimpl/kernfs
parentffffdac11e14b1baadf19d357c1fbd20ce2931ee (diff)
parente5f05d9bf4cfad75c295abfe2f994688a8863102 (diff)
Merge release-20200810.0-58-ge5f05d9bf (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/kernfs')
-rw-r--r--pkg/sentry/fsimpl/kernfs/inode_impl_util.go19
-rw-r--r--pkg/sentry/fsimpl/kernfs/kernfs.go4
2 files changed, 6 insertions, 17 deletions
diff --git a/pkg/sentry/fsimpl/kernfs/inode_impl_util.go b/pkg/sentry/fsimpl/kernfs/inode_impl_util.go
index c3efcf3ec..fe8a1e710 100644
--- a/pkg/sentry/fsimpl/kernfs/inode_impl_util.go
+++ b/pkg/sentry/fsimpl/kernfs/inode_impl_util.go
@@ -48,10 +48,6 @@ func (InodeNoopRefCount) TryIncRef() bool {
return true
}
-// Destroy implements Inode.Destroy.
-func (InodeNoopRefCount) Destroy(context.Context) {
-}
-
// InodeDirectoryNoNewChildren partially implements the Inode interface.
// InodeDirectoryNoNewChildren represents a directory inode which does not
// support creation of new children.
@@ -367,15 +363,12 @@ func (o *OrderedChildren) Init(opts OrderedChildrenOptions) {
// DecRef implements Inode.DecRef.
func (o *OrderedChildren) DecRef(ctx context.Context) {
- o.AtomicRefCount.DecRefWithDestructor(ctx, o.Destroy)
-}
-
-// Destroy cleans up resources referenced by this OrderedChildren.
-func (o *OrderedChildren) Destroy(context.Context) {
- o.mu.Lock()
- defer o.mu.Unlock()
- o.order.Reset()
- o.set = nil
+ o.AtomicRefCount.DecRefWithDestructor(ctx, func(context.Context) {
+ o.mu.Lock()
+ defer o.mu.Unlock()
+ o.order.Reset()
+ o.set = nil
+ })
}
// Populate inserts children into this OrderedChildren, and d's dentry
diff --git a/pkg/sentry/fsimpl/kernfs/kernfs.go b/pkg/sentry/fsimpl/kernfs/kernfs.go
index 080118841..51dbc050c 100644
--- a/pkg/sentry/fsimpl/kernfs/kernfs.go
+++ b/pkg/sentry/fsimpl/kernfs/kernfs.go
@@ -328,10 +328,6 @@ type inodeRefs interface {
IncRef()
DecRef(ctx context.Context)
TryIncRef() bool
- // Destroy is called when the inode reaches zero references. Destroy release
- // all resources (references) on objects referenced by the inode, including
- // any child dentries.
- Destroy(ctx context.Context)
}
type inodeMetadata interface {