Turn IPC unmount errors into warnings.
| ... | ... |
@@ -339,9 +339,7 @@ func (streamConfig *streamConfig) StderrPipe() io.ReadCloser {
|
| 339 | 339 |
func (container *Container) cleanup() {
|
| 340 | 340 |
container.releaseNetwork() |
| 341 | 341 |
|
| 342 |
- if err := container.unmountIpcMounts(detachMounted); err != nil {
|
|
| 343 |
- logrus.Errorf("%s: Failed to umount ipc filesystems: %v", container.ID, err)
|
|
| 344 |
- } |
|
| 342 |
+ container.unmountIpcMounts(detachMounted) |
|
| 345 | 343 |
|
| 346 | 344 |
container.conditionalUnmountOnCleanup() |
| 347 | 345 |
|
| ... | ... |
@@ -1378,22 +1378,21 @@ func (container *Container) setupIpcDirs() error {
|
| 1378 | 1378 |
return nil |
| 1379 | 1379 |
} |
| 1380 | 1380 |
|
| 1381 |
-func (container *Container) unmountIpcMounts(unmount func(pth string) error) error {
|
|
| 1381 |
+func (container *Container) unmountIpcMounts(unmount func(pth string) error) {
|
|
| 1382 | 1382 |
if container.hostConfig.IpcMode.IsContainer() || container.hostConfig.IpcMode.IsHost() {
|
| 1383 |
- return nil |
|
| 1383 |
+ return |
|
| 1384 | 1384 |
} |
| 1385 | 1385 |
|
| 1386 |
- var errors []string |
|
| 1386 |
+ var warnings []string |
|
| 1387 | 1387 |
|
| 1388 | 1388 |
if !container.hasMountFor("/dev/shm") {
|
| 1389 | 1389 |
shmPath, err := container.shmPath() |
| 1390 | 1390 |
if err != nil {
|
| 1391 | 1391 |
logrus.Error(err) |
| 1392 |
- errors = append(errors, err.Error()) |
|
| 1393 |
- } else {
|
|
| 1392 |
+ warnings = append(warnings, err.Error()) |
|
| 1393 |
+ } else if shmPath != "" {
|
|
| 1394 | 1394 |
if err := unmount(shmPath); err != nil {
|
| 1395 |
- logrus.Errorf("failed to umount %s: %v", shmPath, err)
|
|
| 1396 |
- errors = append(errors, err.Error()) |
|
| 1395 |
+ warnings = append(warnings, fmt.Sprintf("failed to umount %s: %v", shmPath, err))
|
|
| 1397 | 1396 |
} |
| 1398 | 1397 |
|
| 1399 | 1398 |
} |
| ... | ... |
@@ -1403,20 +1402,17 @@ func (container *Container) unmountIpcMounts(unmount func(pth string) error) err |
| 1403 | 1403 |
mqueuePath, err := container.mqueuePath() |
| 1404 | 1404 |
if err != nil {
|
| 1405 | 1405 |
logrus.Error(err) |
| 1406 |
- errors = append(errors, err.Error()) |
|
| 1407 |
- } else {
|
|
| 1406 |
+ warnings = append(warnings, err.Error()) |
|
| 1407 |
+ } else if mqueuePath != "" {
|
|
| 1408 | 1408 |
if err := unmount(mqueuePath); err != nil {
|
| 1409 |
- logrus.Errorf("failed to umount %s: %v", mqueuePath, err)
|
|
| 1410 |
- errors = append(errors, err.Error()) |
|
| 1409 |
+ warnings = append(warnings, fmt.Sprintf("failed to umount %s: %v", mqueuePath, err))
|
|
| 1411 | 1410 |
} |
| 1412 | 1411 |
} |
| 1413 | 1412 |
} |
| 1414 | 1413 |
|
| 1415 |
- if len(errors) > 0 {
|
|
| 1416 |
- return fmt.Errorf("failed to cleanup ipc mounts:\n%v", strings.Join(errors, "\n"))
|
|
| 1414 |
+ if len(warnings) > 0 {
|
|
| 1415 |
+ logrus.Warnf("failed to cleanup ipc mounts:\n%v", strings.Join(warnings, "\n"))
|
|
| 1417 | 1416 |
} |
| 1418 |
- |
|
| 1419 |
- return nil |
|
| 1420 | 1417 |
} |
| 1421 | 1418 |
|
| 1422 | 1419 |
func (container *Container) ipcMounts() []execdriver.Mount {
|
| ... | ... |
@@ -177,8 +177,7 @@ func (container *Container) setupIpcDirs() error {
|
| 177 | 177 |
return nil |
| 178 | 178 |
} |
| 179 | 179 |
|
| 180 |
-func (container *Container) unmountIpcMounts(unmount func(pth string) error) error {
|
|
| 181 |
- return nil |
|
| 180 |
+func (container *Container) unmountIpcMounts(unmount func(pth string) error) {
|
|
| 182 | 181 |
} |
| 183 | 182 |
|
| 184 | 183 |
func detachMounted(path string) error {
|
| ... | ... |
@@ -232,9 +232,8 @@ func (daemon *Daemon) Register(container *Container) error {
|
| 232 | 232 |
} |
| 233 | 233 |
daemon.execDriver.Terminate(cmd) |
| 234 | 234 |
|
| 235 |
- if err := container.unmountIpcMounts(mount.Unmount); err != nil {
|
|
| 236 |
- logrus.Errorf("%s: Failed to umount ipc filesystems: %v", container.ID, err)
|
|
| 237 |
- } |
|
| 235 |
+ container.unmountIpcMounts(mount.Unmount) |
|
| 236 |
+ |
|
| 238 | 237 |
if err := container.Unmount(); err != nil {
|
| 239 | 238 |
logrus.Debugf("unmount error %s", err)
|
| 240 | 239 |
} |