diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-08-19 04:57:55 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-08-19 04:57:55 +0000 |
commit | b25f808c5507b5fcc5855ce674a6b4d0cea27912 (patch) | |
tree | 47a313e10053d50121c66d9e5c65bc8728c42547 /pkg/sentry/fsimpl/host/host.go | |
parent | ffffdac11e14b1baadf19d357c1fbd20ce2931ee (diff) | |
parent | e5f05d9bf4cfad75c295abfe2f994688a8863102 (diff) |
Merge release-20200810.0-58-ge5f05d9bf (automated)
Diffstat (limited to 'pkg/sentry/fsimpl/host/host.go')
-rw-r--r-- | pkg/sentry/fsimpl/host/host.go | 19 |
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. |