summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--pkg/sentry/kernel/fd_table.go7
-rw-r--r--pkg/sentry/vfs/file_description.go7
2 files changed, 7 insertions, 7 deletions
diff --git a/pkg/sentry/kernel/fd_table.go b/pkg/sentry/kernel/fd_table.go
index 97aa679ed..a6afabb1c 100644
--- a/pkg/sentry/kernel/fd_table.go
+++ b/pkg/sentry/kernel/fd_table.go
@@ -159,13 +159,6 @@ func (f *FDTable) dropVFS2(ctx context.Context, file *vfs.FileDescription) {
panic(fmt.Sprintf("UnlockPOSIX failed: %v", err))
}
- // Generate inotify events.
- ev := uint32(linux.IN_CLOSE_NOWRITE)
- if file.IsWritable() {
- ev = linux.IN_CLOSE_WRITE
- }
- file.Dentry().InotifyWithParent(ctx, ev, 0, vfs.PathEvent)
-
// Drop the table's reference.
file.DecRef(ctx)
}
diff --git a/pkg/sentry/vfs/file_description.go b/pkg/sentry/vfs/file_description.go
index eb6c2e36b..326e35688 100644
--- a/pkg/sentry/vfs/file_description.go
+++ b/pkg/sentry/vfs/file_description.go
@@ -161,6 +161,13 @@ func (fd *FileDescription) Init(impl FileDescriptionImpl, flags uint32, mnt *Mou
// DecRef decrements fd's reference count.
func (fd *FileDescription) DecRef(ctx context.Context) {
fd.FileDescriptionRefs.DecRef(func() {
+ // Generate inotify events.
+ ev := uint32(linux.IN_CLOSE_NOWRITE)
+ if fd.IsWritable() {
+ ev = linux.IN_CLOSE_WRITE
+ }
+ fd.Dentry().InotifyWithParent(ctx, ev, 0, PathEvent)
+
// Unregister fd from all epoll instances.
fd.epollMu.Lock()
epolls := fd.epolls