mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
vfs: use ancestryMu in implementations of DentryImpl.InotifyWithParent
This lock was introduced in cl/696713993 and only protects parent/name for all dentries, which is all that's required by InotifyWithParent(). PiperOrigin-RevId: 697016824
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user