diff options
author | Dean Deng <deandeng@google.com> | 2020-08-18 21:52:08 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-08-18 21:54:08 -0700 |
commit | e5f05d9bf4cfad75c295abfe2f994688a8863102 (patch) | |
tree | 6a3bfef9ba8f5f6fac32a08e40801ca47b03f487 /pkg/sentry/fsimpl/host | |
parent | f2822da54293aaf1c161bde62dcfddfc234e4394 (diff) |
Get rid of kernfs.Inode.Destroy.
This interface method is unneeded.
PiperOrigin-RevId: 327370325
Diffstat (limited to 'pkg/sentry/fsimpl/host')
-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. |