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:
Ayush Ranjan
2022-09-27 10:44:26 -07:00
committed by gVisor bot
parent c9d9899ea9
commit 6ac829ca1e
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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),
}