Browse code

daemon: openContainerFS: log cleanup errors

These errors were unhandled; log them (at debug level for now).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2024/07/26 20:47:07
Showing 1 changed files
... ...
@@ -61,7 +61,9 @@ func (daemon *Daemon) openContainerFS(ctr *container.Container) (_ *containerFSV
61 61
 	}
62 62
 	defer func() {
63 63
 		if retErr != nil {
64
-			_ = daemon.Unmount(ctr)
64
+			if err := daemon.Unmount(ctr); err != nil {
65
+				log.G(ctx).WithError(err).Debug("Failed to unmount container after failure")
66
+			}
65 67
 		}
66 68
 	}()
67 69
 
... ...
@@ -71,9 +73,13 @@ func (daemon *Daemon) openContainerFS(ctr *container.Container) (_ *containerFSV
71 71
 	}
72 72
 	defer func() {
73 73
 		ctx := context.WithoutCancel(ctx)
74
-		cleanup(ctx)
74
+		if err := cleanup(ctx); err != nil {
75
+			log.G(ctx).WithError(err).Debug("Failed to cleanup container mounts")
76
+		}
75 77
 		if retErr != nil {
76
-			_ = ctr.UnmountVolumes(ctx, daemon.LogVolumeEvent)
78
+			if err := ctr.UnmountVolumes(ctx, daemon.LogVolumeEvent); err != nil {
79
+				log.G(ctx).WithError(err).Debug("Failed to unmount container volumes after failure")
80
+			}
77 81
 		}
78 82
 	}()
79 83