mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix bind() on overlays.
InodeOperations.Bind now returns a Dirent which will be cached in the Dirent tree. When an overlay is in-use, Bind cannot return the Dirent created by the upper filesystem because the Dirent does not know about the overlay. Instead, overlayBind must create a new overlay-aware Inode and Dirent and return that. This is analagous to how Lookup and overlayLookup work. PiperOrigin-RevId: 208670710 Change-Id: I6390affbcf94c38656b4b458e248739b4853da29
This commit is contained in:
committed by
Shentubot
parent
dde836a918
commit
66b0f3e15a
@@ -364,7 +364,23 @@ func overlayBind(ctx context.Context, o *overlayEntry, name string, data unix.Bo
|
||||
if o.upper == nil {
|
||||
return nil, syserror.EOPNOTSUPP
|
||||
}
|
||||
return o.upper.InodeOperations.Bind(ctx, o.upper, name, data, perm)
|
||||
d, err := o.upper.InodeOperations.Bind(ctx, o.upper, name, data, perm)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Grab the inode and drop the dirent, we don't need it.
|
||||
inode := d.Inode
|
||||
inode.IncRef()
|
||||
d.DecRef()
|
||||
|
||||
// Create a new overlay entry and dirent for the socket.
|
||||
entry, err := newOverlayEntry(ctx, inode, nil, false)
|
||||
if err != nil {
|
||||
inode.DecRef()
|
||||
return nil, err
|
||||
}
|
||||
return NewDirent(newOverlayInode(ctx, entry, inode.MountSource), name), nil
|
||||
}
|
||||
|
||||
func overlayBoundEndpoint(o *overlayEntry, path string) unix.BoundEndpoint {
|
||||
|
||||
Reference in New Issue
Block a user