Automated rollback of changelist 501387753

PiperOrigin-RevId: 502230620
This commit is contained in:
Ayush Ranjan
2023-01-15 12:00:31 -08:00
committed by gVisor bot
parent d3894e4481
commit 42e92cae6e
2 changed files with 13 additions and 13 deletions
+3 -4
View File
@@ -253,10 +253,9 @@ func compileMounts(spec *specs.Spec, conf *config.Config) []specs.Mount {
}
// goferMountData creates a slice of gofer mount data.
func goferMountData(fd int, fa config.FileAccessType, dstPath string) []string {
func goferMountData(fd int, fa config.FileAccessType) []string {
opts := []string{
"trans=fd",
"aname=" + dstPath,
"rfdno=" + strconv.Itoa(fd),
"wfdno=" + strconv.Itoa(fd),
}
@@ -402,7 +401,7 @@ func (c *containerMounter) mountAll(conf *config.Config, procArgs *kernel.Create
// createMountNamespace creates the container's root mount and namespace.
func (c *containerMounter) createMountNamespace(ctx context.Context, conf *config.Config, creds *auth.Credentials) (*vfs.MountNamespace, error) {
fd := c.fds.remove()
data := goferMountData(fd, conf.FileAccess, "/")
data := goferMountData(fd, conf.FileAccess)
// We can't check for overlayfs here because sandbox is chroot'ed and gofer
// can only send mount options for specs.Mounts (specs.Root is missing
@@ -712,7 +711,7 @@ func (c *containerMounter) getMountNameAndOptions(conf *config.Config, m *mountA
// but unlikely to be correct in this context.
return "", nil, false, fmt.Errorf("gofer mount requires a connection FD")
}
data = goferMountData(m.fd, c.getMountAccessType(conf, m.mount), m.mount.Destination)
data = goferMountData(m.fd, c.getMountAccessType(conf, m.mount))
internalData = gofer.InternalFilesystemOptions{
UniqueID: m.mount.Destination,
}
+10 -9
View File
@@ -246,8 +246,9 @@ func newSocket(ioFD int) *unet.Socket {
func (g *Gofer) serve(spec *specs.Spec, conf *config.Config, root string) subcommands.ExitStatus {
type connectionConfig struct {
sock *unet.Socket
readonly bool
sock *unet.Socket
mountPath string
readonly bool
}
cfgs := make([]connectionConfig, 0, len(spec.Mounts)+1)
server := fsgofer.NewLisafsServer(fsgofer.Config{
@@ -260,8 +261,9 @@ func (g *Gofer) serve(spec *specs.Spec, conf *config.Config, root string) subcom
// Start with root mount, then add any other additional mount as needed.
cfgs = append(cfgs, connectionConfig{
sock: newSocket(g.ioFDs[0]),
readonly: spec.Root.Readonly || overlay2.RootMount,
sock: newSocket(g.ioFDs[0]),
mountPath: "/", // fsgofer process is always chroot()ed. So serve root.
readonly: spec.Root.Readonly || overlay2.RootMount,
})
log.Infof("Serving %q mapped to %q on FD %d (ro: %t)", "/", root, g.ioFDs[0], cfgs[0].readonly)
@@ -279,8 +281,9 @@ func (g *Gofer) serve(spec *specs.Spec, conf *config.Config, root string) subcom
}
cfgs = append(cfgs, connectionConfig{
sock: newSocket(g.ioFDs[mountIdx]),
readonly: isReadonlyMount(m.Options) || overlay2.SubMounts,
sock: newSocket(g.ioFDs[mountIdx]),
mountPath: m.Destination,
readonly: isReadonlyMount(m.Options) || overlay2.SubMounts,
})
log.Infof("Serving %q mapped on FD %d (ro: %t)", m.Destination, g.ioFDs[mountIdx], cfgs[mountIdx].readonly)
@@ -293,9 +296,7 @@ func (g *Gofer) serve(spec *specs.Spec, conf *config.Config, root string) subcom
cfgs = cfgs[:mountIdx]
for _, cfg := range cfgs {
// fsgofer process is always chroot()ed. So we can serve root. The gofer
// client should walk to the right mount point from the root.
conn, err := server.CreateConnection(cfg.sock, "/", cfg.readonly)
conn, err := server.CreateConnection(cfg.sock, cfg.mountPath, cfg.readonly)
if err != nil {
util.Fatalf("starting connection on FD %d for gofer mount failed: %v", cfg.sock.FD(), err)
}