mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Invalidate overlay.dentry.dirents during open() file creation.
Updates #1199 PiperOrigin-RevId: 339528827
This commit is contained in:
@@ -976,7 +976,10 @@ func (fs *filesystem) createAndOpenLocked(ctx context.Context, rp *vfs.Resolving
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
// Finally construct the overlay FD.
|
||||
// Finally construct the overlay FD. Below this point, we don't perform
|
||||
// cleanup (the file was created successfully even if we can no longer open
|
||||
// it for some reason).
|
||||
parent.dirents = nil
|
||||
upperFlags := upperFD.StatusFlags()
|
||||
fd := ®ularFileFD{
|
||||
copiedUp: true,
|
||||
@@ -987,8 +990,6 @@ func (fs *filesystem) createAndOpenLocked(ctx context.Context, rp *vfs.Resolving
|
||||
upperFDOpts := upperFD.Options()
|
||||
if err := fd.vfsfd.Init(fd, upperFlags, mnt, &child.vfsd, &upperFDOpts); err != nil {
|
||||
upperFD.DecRef(ctx)
|
||||
// Don't bother with cleanup; the file was created successfully, we
|
||||
// just can't open it anymore for some reason.
|
||||
return nil, err
|
||||
}
|
||||
parent.watches.Notify(ctx, childName, linux.IN_CREATE, 0 /* cookie */, vfs.PathEvent, false /* unlinked */)
|
||||
|
||||
Reference in New Issue
Block a user