mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #17554 from calavera/warm_ipc_unmounts
Turn IPC unmount errors into warnings.
This commit is contained in:
commit
944ea3134d
4 changed files with 15 additions and 23 deletions
|
@ -339,9 +339,7 @@ func (streamConfig *streamConfig) StderrPipe() io.ReadCloser {
|
||||||
func (container *Container) cleanup() {
|
func (container *Container) cleanup() {
|
||||||
container.releaseNetwork()
|
container.releaseNetwork()
|
||||||
|
|
||||||
if err := container.unmountIpcMounts(detachMounted); err != nil {
|
container.unmountIpcMounts(detachMounted)
|
||||||
logrus.Errorf("%s: Failed to umount ipc filesystems: %v", container.ID, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
container.conditionalUnmountOnCleanup()
|
container.conditionalUnmountOnCleanup()
|
||||||
|
|
||||||
|
|
|
@ -1378,22 +1378,21 @@ func (container *Container) setupIpcDirs() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *Container) unmountIpcMounts(unmount func(pth string) error) error {
|
func (container *Container) unmountIpcMounts(unmount func(pth string) error) {
|
||||||
if container.hostConfig.IpcMode.IsContainer() || container.hostConfig.IpcMode.IsHost() {
|
if container.hostConfig.IpcMode.IsContainer() || container.hostConfig.IpcMode.IsHost() {
|
||||||
return nil
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var errors []string
|
var warnings []string
|
||||||
|
|
||||||
if !container.hasMountFor("/dev/shm") {
|
if !container.hasMountFor("/dev/shm") {
|
||||||
shmPath, err := container.shmPath()
|
shmPath, err := container.shmPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
errors = append(errors, err.Error())
|
warnings = append(warnings, err.Error())
|
||||||
} else {
|
} else if shmPath != "" {
|
||||||
if err := unmount(shmPath); err != nil {
|
if err := unmount(shmPath); err != nil {
|
||||||
logrus.Errorf("failed to umount %s: %v", shmPath, err)
|
warnings = append(warnings, fmt.Sprintf("failed to umount %s: %v", shmPath, err))
|
||||||
errors = append(errors, err.Error())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1403,20 +1402,17 @@ func (container *Container) unmountIpcMounts(unmount func(pth string) error) err
|
||||||
mqueuePath, err := container.mqueuePath()
|
mqueuePath, err := container.mqueuePath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
errors = append(errors, err.Error())
|
warnings = append(warnings, err.Error())
|
||||||
} else {
|
} else if mqueuePath != "" {
|
||||||
if err := unmount(mqueuePath); err != nil {
|
if err := unmount(mqueuePath); err != nil {
|
||||||
logrus.Errorf("failed to umount %s: %v", mqueuePath, err)
|
warnings = append(warnings, fmt.Sprintf("failed to umount %s: %v", mqueuePath, err))
|
||||||
errors = append(errors, err.Error())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errors) > 0 {
|
if len(warnings) > 0 {
|
||||||
return fmt.Errorf("failed to cleanup ipc mounts:\n%v", strings.Join(errors, "\n"))
|
logrus.Warnf("failed to cleanup ipc mounts:\n%v", strings.Join(warnings, "\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *Container) ipcMounts() []execdriver.Mount {
|
func (container *Container) ipcMounts() []execdriver.Mount {
|
||||||
|
|
|
@ -177,8 +177,7 @@ func (container *Container) setupIpcDirs() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (container *Container) unmountIpcMounts(unmount func(pth string) error) error {
|
func (container *Container) unmountIpcMounts(unmount func(pth string) error) {
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func detachMounted(path string) error {
|
func detachMounted(path string) error {
|
||||||
|
|
|
@ -232,9 +232,8 @@ func (daemon *Daemon) Register(container *Container) error {
|
||||||
}
|
}
|
||||||
daemon.execDriver.Terminate(cmd)
|
daemon.execDriver.Terminate(cmd)
|
||||||
|
|
||||||
if err := container.unmountIpcMounts(mount.Unmount); err != nil {
|
container.unmountIpcMounts(mount.Unmount)
|
||||||
logrus.Errorf("%s: Failed to umount ipc filesystems: %v", container.ID, err)
|
|
||||||
}
|
|
||||||
if err := container.Unmount(); err != nil {
|
if err := container.Unmount(); err != nil {
|
||||||
logrus.Debugf("unmount error %s", err)
|
logrus.Debugf("unmount error %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue