diff options
author | Dean Deng <deandeng@google.com> | 2020-08-18 21:52:08 -0700 |
---|---|---|
committer | Rahat Mahmood <46939889+mrahatm@users.noreply.github.com> | 2020-08-19 11:38:34 -0700 |
commit | ab98a35a9adb2df0359478b8898e78337e2d0392 (patch) | |
tree | 6a3bfef9ba8f5f6fac32a08e40801ca47b03f487 /pkg/sentry/fsimpl/host/host.go | |
parent | b99fce30936ea42bf00e2c7270dc4ca797f766eb (diff) |
Get rid of kernfs.Inode.Destroy.
This interface method is unneeded.
PiperOrigin-RevId: 327370325
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. |