mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Minor bug fixes in gofer's BindAt mechanism.
- Allow lisafs client to open socket FDs. BindAt is now supported. So opening sockets over a connection should also be supported. - Initialize socket's node with its name. Earlier, we were using the entire host path to init node's name. - vfs.MknodOptions.Endpoint can be a connectionless endpoint, which does not implement transport.HostBoundEndpoint. In such a case, fallback to synthetic sockets. PiperOrigin-RevId: 477212574
This commit is contained in:
@@ -524,7 +524,7 @@ func OpenAtHandler(c *Connection, comm Communicator, payloadLen uint32) (uint32,
|
||||
hostOpenFD int
|
||||
)
|
||||
if err := fd.safelyRead(func() error {
|
||||
if fd.node.isDeleted() || !p9.CanOpen(p9.FileMode(fd.ftype)) {
|
||||
if fd.node.isDeleted() || fd.IsSymlink() {
|
||||
return unix.EINVAL
|
||||
}
|
||||
openFD, hostOpenFD, err = fd.impl.Open(req.Flags)
|
||||
|
||||
@@ -1628,7 +1628,7 @@ func (d *dentry) setStat(ctx context.Context, creds *auth.Credentials, opts *vfs
|
||||
// - d.isDir().
|
||||
// - fs.opts.lisaEnabled.
|
||||
func (d *dentry) mknodLisaLocked(ctx context.Context, name string, creds *auth.Credentials, opts vfs.MknodOptions, ds **[]*dentry) error {
|
||||
if opts.Endpoint == nil {
|
||||
if _, ok := opts.Endpoint.(transport.HostBoundEndpoint); !ok {
|
||||
childInode, err := d.controlFDLisa.MknodAt(ctx, name, opts.Mode, lisafs.UID(creds.EffectiveKUID), lisafs.GID(creds.EffectiveKGID), opts.DevMinor, opts.DevMajor)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -756,7 +756,7 @@ func (fd *controlFDLisa) BindAt(name string, sockType uint32, mode linux.FileMod
|
||||
}
|
||||
cu.Release()
|
||||
|
||||
socketControlFD := newControlFDLisa(sockFD, fd, socketPath, linux.ModeSocket)
|
||||
socketControlFD := newControlFDLisa(sockFD, fd, name, linux.ModeSocket)
|
||||
boundSocketFD := &boundSocketFDLisa{
|
||||
sock: os.NewFile(uintptr(sockFD), socketPath),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user