|
@@ -5,6 +5,7 @@ import (
|
|
|
"fmt"
|
|
|
"os"
|
|
|
"path/filepath"
|
|
|
+ "runtime/debug"
|
|
|
"syscall"
|
|
|
|
|
|
"github.com/containerd/log"
|
|
@@ -88,6 +89,15 @@ func (m *MountPoint) Cleanup(ctx context.Context) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+ logger := log.G(ctx).WithFields(log.Fields{"active": m.active, "id": m.ID})
|
|
|
+
|
|
|
+ // TODO: Remove once the real bug is fixed: https://github.com/moby/moby/issues/46508
|
|
|
+ if m.active == 0 {
|
|
|
+ logger.Error("An attempt to decrement a zero mount count")
|
|
|
+ logger.Error(string(debug.Stack()))
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+
|
|
|
for _, p := range m.safePaths {
|
|
|
if !p.IsValid() {
|
|
|
continue
|
|
@@ -108,6 +118,8 @@ func (m *MountPoint) Cleanup(ctx context.Context) error {
|
|
|
}
|
|
|
|
|
|
m.active--
|
|
|
+ logger.Debug("MountPoint.Cleanup Decrement active count")
|
|
|
+
|
|
|
if m.active == 0 {
|
|
|
m.ID = ""
|
|
|
}
|