diff --git a/snapshots/devmapper/snapshotter.go b/snapshots/devmapper/snapshotter.go index c244cf8e6..c6ed8340b 100644 --- a/snapshots/devmapper/snapshotter.go +++ b/snapshots/devmapper/snapshotter.go @@ -27,6 +27,7 @@ import ( "strings" "sync" + "github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/log" "github.com/containerd/containerd/mount" "github.com/containerd/containerd/plugin" @@ -306,7 +307,11 @@ func (s *Snapshotter) removeDevice(ctx context.Context, key string) error { if !s.config.AsyncRemove { if err := s.pool.RemoveDevice(ctx, deviceName); err != nil { log.G(ctx).WithError(err).Errorf("failed to remove device") - return err + // Tell snapshot GC continue to collect other snapshots. + // Otherwise, one snapshot collection failure will stop + // the GC, and all snapshots won't be collected even though + // having no relationship with the failed one. + return errdefs.ErrFailedPrecondition } } else { // The asynchronous cleanup will do the real device remove work.