summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/host
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/host
parentffffdac11e14b1baadf19d357c1fbd20ce2931ee (diff)
parente5f05d9bf4cfad75c295abfe2f994688a8863102 (diff)
Merge release-20200810.0-58-ge5f05d9bf (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/host')
-rw-r--r--pkg/sentry/fsimpl/host/host.go19
1 files changed, 8 insertions, 11 deletions
diff --git a/pkg/sentry/fsimpl/host/host.go b/pkg/sentry/fsimpl/host/host.go
index bd6caba06..56869f59a 100644
--- a/pkg/sentry/fsimpl/host/host.go
+++ b/pkg/sentry/fsimpl/host/host.go
@@ -432,17 +432,14 @@ func (i *inode) SetStat(ctx context.Context, fs *vfs.Filesystem, creds *auth.Cre
// DecRef implements kernfs.Inode.
func (i *inode) DecRef(ctx context.Context) {
- i.AtomicRefCount.DecRefWithDestructor(ctx, i.Destroy)
-}
-
-// Destroy implements kernfs.Inode.
-func (i *inode) Destroy(context.Context) {
- if i.wouldBlock {
- fdnotifier.RemoveFD(int32(i.hostFD))
- }
- if err := unix.Close(i.hostFD); err != nil {
- log.Warningf("failed to close host fd %d: %v", i.hostFD, err)
- }
+ i.AtomicRefCount.DecRefWithDestructor(ctx, func(context.Context) {
+ if i.wouldBlock {
+ fdnotifier.RemoveFD(int32(i.hostFD))
+ }
+ if err := unix.Close(i.hostFD); err != nil {
+ log.Warningf("failed to close host fd %d: %v", i.hostFD, err)
+ }
+ })
}
// Open implements kernfs.Inode.