10000 Don't block snapshot garbage collection on Remove failures · containerd/containerd@ed7c689 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed7c689

Browse files
committed
Don't block snapshot garbage collection on Remove failures
If a snapshot removal fails (during garbage collection), the entire garbage collection operation is cancelled. This is problematic because once cleanup of any snapshot fails no other snapshots will be cleaned and the disk usage will just keep increasing. Solution is to return snapshot removal errors wrapped as "ErrFailedPrecondition" errors. The garbage collectors continues cleanup if the error is of this type. E3C6 Signed-off-by: Amit Barve <ambarve@microsoft.com> (cherry picked from commit ad96fde) Signed-off-by: Amit Barve <ambarve@microsoft.com>
1 parent 467de56 commit ed7c689

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

snapshots/windows/windows.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,9 @@ func (s *snapshotter) Remove(ctx context.Context, key string) error {
280280
log.G(ctx).WithError(err1).WithField("path", renamed).Error("Failed to rename after failed commit")
281281
}
282282
}
283-
return err
283+
// Return the error wrapped in ErrFailedPrecondition so that cleanup of other snapshots will
284+
// still continue.
285+
return errors.Join(errdefs.ErrFailedPrecondition, err)
284286
}
285287

286288
if err = hcsshim.DestroyLayer(s.info, renamedID); err != nil {

0 commit comments

Comments
 (0)
0