|
@@ -121,7 +121,7 @@ func (c *client) Restore(ctx context.Context, id string, attachStdio StdioCallba
|
|
c.Lock()
|
|
c.Lock()
|
|
defer c.Unlock()
|
|
defer c.Unlock()
|
|
|
|
|
|
- var rio cio.IO
|
|
|
|
|
|
+ var rio *cio.DirectIO
|
|
defer func() {
|
|
defer func() {
|
|
err = wrapError(err)
|
|
err = wrapError(err)
|
|
}()
|
|
}()
|
|
@@ -139,13 +139,12 @@ func (c *client) Restore(ctx context.Context, id string, attachStdio StdioCallba
|
|
}()
|
|
}()
|
|
|
|
|
|
t, err := ctr.Task(ctx, func(fifos *cio.FIFOSet) (cio.IO, error) {
|
|
t, err := ctr.Task(ctx, func(fifos *cio.FIFOSet) (cio.IO, error) {
|
|
- io, err := newIOPipe(fifos)
|
|
|
|
|
|
+ rio, err = cio.NewDirectIO(ctx, fifos)
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
|
|
- rio, err = attachStdio(io)
|
|
|
|
- return rio, err
|
|
|
|
|
|
+ return attachStdio(rio)
|
|
})
|
|
})
|
|
if err != nil && !errdefs.IsNotFound(errors.Cause(err)) {
|
|
if err != nil && !errdefs.IsNotFound(errors.Cause(err)) {
|
|
return false, -1, err
|
|
return false, -1, err
|
|
@@ -255,7 +254,7 @@ func (c *client) Start(ctx context.Context, id, checkpointDir string, withStdin
|
|
uid, gid := getSpecUser(spec)
|
|
uid, gid := getSpecUser(spec)
|
|
t, err = ctr.ctr.NewTask(ctx,
|
|
t, err = ctr.ctr.NewTask(ctx,
|
|
func(id string) (cio.IO, error) {
|
|
func(id string) (cio.IO, error) {
|
|
- fifos := newFIFOSet(ctr.bundleDir, id, InitProcessName, withStdin, spec.Process.Terminal)
|
|
|
|
|
|
+ fifos := newFIFOSet(ctr.bundleDir, InitProcessName, withStdin, spec.Process.Terminal)
|
|
rio, err = c.createIO(fifos, id, InitProcessName, stdinCloseSync, attachStdio)
|
|
rio, err = c.createIO(fifos, id, InitProcessName, stdinCloseSync, attachStdio)
|
|
return rio, err
|
|
return rio, err
|
|
},
|
|
},
|
|
@@ -315,7 +314,7 @@ func (c *client) Exec(ctx context.Context, containerID, processID string, spec *
|
|
stdinCloseSync = make(chan struct{})
|
|
stdinCloseSync = make(chan struct{})
|
|
)
|
|
)
|
|
|
|
|
|
- fifos := newFIFOSet(ctr.bundleDir, containerID, processID, withStdin, spec.Terminal)
|
|
|
|
|
|
+ fifos := newFIFOSet(ctr.bundleDir, processID, withStdin, spec.Terminal)
|
|
|
|
|
|
defer func() {
|
|
defer func() {
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -612,7 +611,7 @@ func (c *client) getProcess(containerID, processID string) (containerd.Process,
|
|
// createIO creates the io to be used by a process
|
|
// createIO creates the io to be used by a process
|
|
// This needs to get a pointer to interface as upon closure the process may not have yet been registered
|
|
// This needs to get a pointer to interface as upon closure the process may not have yet been registered
|
|
func (c *client) createIO(fifos *cio.FIFOSet, containerID, processID string, stdinCloseSync chan struct{}, attachStdio StdioCallback) (cio.IO, error) {
|
|
func (c *client) createIO(fifos *cio.FIFOSet, containerID, processID string, stdinCloseSync chan struct{}, attachStdio StdioCallback) (cio.IO, error) {
|
|
- io, err := newIOPipe(fifos)
|
|
|
|
|
|
+ io, err := cio.NewDirectIO(context.Background(), fifos)
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
@@ -687,7 +686,7 @@ func (c *client) processEvent(ctr *container, et EventType, ei EventInfo) {
|
|
"container": ei.ContainerID,
|
|
"container": ei.ContainerID,
|
|
}).Error("failed to find container")
|
|
}).Error("failed to find container")
|
|
} else {
|
|
} else {
|
|
- rmFIFOSet(newFIFOSet(ctr.bundleDir, ei.ContainerID, ei.ProcessID, true, false))
|
|
|
|
|
|
+ rmFIFOSet(newFIFOSet(ctr.bundleDir, ei.ProcessID, true, false))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|