diff --git a/pkg/sentry/fsimpl/gofer/gofer.go b/pkg/sentry/fsimpl/gofer/gofer.go index d3faea5f7..19800e4ea 100644 --- a/pkg/sentry/fsimpl/gofer/gofer.go +++ b/pkg/sentry/fsimpl/gofer/gofer.go @@ -1544,13 +1544,13 @@ func (d *dentry) InotifyWithParent(ctx context.Context, events, cookie uint32, e events |= linux.IN_ISDIR } - d.fs.renameMu.RLock() + d.fs.ancestryMu.RLock() // The ordering below is important, Linux always notifies the parent first. if parent := d.parent.Load(); parent != nil { parent.watches.Notify(ctx, d.name, events, cookie, et, d.isDeleted()) } d.watches.Notify(ctx, "", events, cookie, et, d.isDeleted()) - d.fs.renameMu.RUnlock() + d.fs.ancestryMu.RUnlock() } // Watches implements vfs.DentryImpl.Watches. diff --git a/pkg/sentry/fsimpl/kernfs/kernfs.go b/pkg/sentry/fsimpl/kernfs/kernfs.go index 8512411cf..e197f6433 100644 --- a/pkg/sentry/fsimpl/kernfs/kernfs.go +++ b/pkg/sentry/fsimpl/kernfs/kernfs.go @@ -541,11 +541,11 @@ func (d *Dentry) InotifyWithParent(ctx context.Context, events, cookie uint32, e // Don't bother looking for a parent if the inode is anonymous. It // won't have one. if !d.inode.Anonymous() { - d.fs.mu.RLock() + d.fs.ancestryMu.RLock() if parent := d.parent.Load(); parent != nil { parent.inode.Watches().Notify(ctx, d.name, events, cookie, et, d.isDeleted()) } - d.fs.mu.RUnlock() + d.fs.ancestryMu.RUnlock() } d.inode.Watches().Notify(ctx, "", events, cookie, et, d.isDeleted()) diff --git a/pkg/sentry/fsimpl/overlay/overlay.go b/pkg/sentry/fsimpl/overlay/overlay.go index d4d0e7735..d14a9c4f8 100644 --- a/pkg/sentry/fsimpl/overlay/overlay.go +++ b/pkg/sentry/fsimpl/overlay/overlay.go @@ -748,13 +748,13 @@ func (d *dentry) InotifyWithParent(ctx context.Context, events uint32, cookie ui // that d was deleted. deleted := d.vfsd.IsDead() - d.fs.renameMu.RLock() + d.fs.ancestryMu.RLock() // The ordering below is important, Linux always notifies the parent first. if parent := d.parent.Load(); parent != nil { parent.watches.Notify(ctx, d.name, events, cookie, et, deleted) } d.watches.Notify(ctx, "", events, cookie, et, deleted) - d.fs.renameMu.RUnlock() + d.fs.ancestryMu.RUnlock() } // Watches implements vfs.DentryImpl.Watches. diff --git a/pkg/sentry/fsimpl/tmpfs/tmpfs.go b/pkg/sentry/fsimpl/tmpfs/tmpfs.go index 8a75f27f4..23131c983 100644 --- a/pkg/sentry/fsimpl/tmpfs/tmpfs.go +++ b/pkg/sentry/fsimpl/tmpfs/tmpfs.go @@ -442,14 +442,14 @@ func (d *dentry) InotifyWithParent(ctx context.Context, events, cookie uint32, e // that d was deleted. deleted := d.vfsd.IsDead() - d.inode.fs.mu.RLock() + d.inode.fs.ancestryMu.RLock() // The ordering below is important, Linux always notifies the parent first. parent := d.parent.Load() if parent != nil { parent.inode.watches.Notify(ctx, d.name, events, cookie, et, deleted) } d.inode.watches.Notify(ctx, "", events, cookie, et, deleted) - d.inode.fs.mu.RUnlock() + d.inode.fs.ancestryMu.RUnlock() } // Watches implements vfs.DentryImpl.Watches. diff --git a/pkg/sentry/vfs/vfs.go b/pkg/sentry/vfs/vfs.go index e7ec567a9..0727c46f9 100644 --- a/pkg/sentry/vfs/vfs.go +++ b/pkg/sentry/vfs/vfs.go @@ -18,11 +18,11 @@ // // EpollInstance.interestMu // FileDescription.epollMu -// Locks acquired by FilesystemImpl/FileDescriptionImpl methods (except FilesystemImpl.PrependPath and IsDescendant) +// Locks acquired by FilesystemImpl/DentryImpl/FileDescriptionImpl methods (except FilesystemImpl.PrependPath, FilesystemImpl.IsDescendant, DentryImpl.InotifyWithParent) // VirtualFilesystem.mountMu // Dentry.mu // Locks acquired by FilesystemImpls between Prepare{Delete,Rename}Dentry and Commit{Delete,Rename*}Dentry -// Locks acquired by FilesystemImpl.PrependPath and IsDescendant (typically genericfstree.Filesystem.ancestryMu) +// Locks acquired by FilesystemImpl.PrependPath, FilesystemImpl.IsDescendant, DentryImpl.InotifyWithParent (typically genericfstree.Filesystem.ancestryMu) // VirtualFilesystem.filesystemsMu // fdnotifier.notifier.mu // EpollInstance.readyMu